Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podio API appears to be returning the incorrect type for user emails in grants #79

Open
enragedlemon opened this issue Mar 11, 2015 · 1 comment

Comments

@enragedlemon
Copy link
Contributor

Using the latest version of the Podio-PHP client for the API, calling PodioGrant::getfor( 'item', $itemid ) causes the following error notice:

Notice: Array to string conversion in /var/www/api/Podio/lib/PodioObject.php on line 162

When examining the data returned by the call (see snippet below), we notice that user mails has has been cast from array to string, causing a string of "Array" to be returned.

[user] => PodioUser Object
(
[_attributes:PodioObject:private] => Array
(
[userid] => 1234567
[profile_id] => 1234567
[name] => Joe Blogs
[link] => https://podio.com/users/1234567
[mail] => Array
[type] => user
)

This can be fixed temporarily by changing PodioObject.php[162] from

$this->attributes[$name] = $value ? (string)$value : null;

to

$this->attributes[$name] = $value ? ( is_array( $value ) ? $value : (string) $value ) : null;

Clearly, this isn't an ideal solution, and I suspect may need to be addressed elsewhere instead.

@enragedlemon
Copy link
Contributor Author

Andreas has addressed the error with this commit, but I don't think this addresses the underlying issue. The mails data is multi-part, as the user can have multiple account emails. As such, I feel this data should be returned as an array. That would mean that whatever on the API-side that is reporting the mail array as a string should be fixed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants