@nyodulf – is_scalar( null ) would would return false and the expression on line 176 would be computed based on that boolean value returning $image->pid
Please see this … http://php.net/manual/en/function.is-scalar.php … for reference.
Are you specifically seeing a message that indicates something different?
Thanks!
– Cais.
@photocrati
Here are the lines:
$image = isset($params['image']) ? $params['image'] : null;
$image_id = is_scalar($image) ? (int) $image : $image->pid;
So if $params[‘image’] is not found, $image will be null. The next line checks if $image is scalar, which return false, so PHP will try to set $image_id to the value of $image->pid, but we’ve already established that $image is null…
It is fixed by changing line 176 to
$image_id = (is_scalar($image) || is_null($image)) ? (int) $image : $image->pid;
This way, $image_id gets set to the integer 0 if $image is null. I’m not sure if that’s what should happen, but it prevents the error that shows (trying to get property of non-object $image) otherwise.
@nyodulf – Hmm … I see what you are saying now, but it would be good to see the error message first-hand, do you have a public link where it is appearing?
As it is, I will let our developers know about this logic condition so they can review this further as well.
Thanks!
– Cais.
@photocrati – sorry, no public link 🙁 – I came across it while working on a private intranet site, but the text content was as stated above: “trying to get property of non-object” for $image
@nyodulf – Well, a “private intranet” should not be the cause of that, but if you happen across this in a remote site, please let us know.
Thanks!
– Cais.
I’m not seeing any obvious ways this could be triggered, but I can’t argue with the change in logic. I’ve committed an update with your proposed change, thanks nyodulf!