Open mhsdesign opened 2 years ago
Sounds as it could be pretty breaking indeed. To me a case of rather won't fix and fix the edge case on the other side? What kind of nasty object is this 😂
Yes pretty nasty - i was just levering every php trick ^^
much more critical is, that call and public object properties cannot co-exist this way as @nezaniel pointed out in the slack thread above. Im for fixing this like suggested: use call only as last resort.
Current workaround would be:
in the __call strip the get
part of the methodName and make the first letter lower case, then proceed as you want: eg return a public property or similar.
I wonder what kind of real-life object has ArrayAccess
and __call()
implemented together…
No one. But some proxy object for EEL use only might.
Description
EEL uses
ObjectAccess::getProperty
https://github.com/neos/flow-development-collection/blob/1956920c41b5eb9348daaaf03543efaa45b098b2/Neos.Eel/Classes/Context.php#L65when you put into
ObjectAccess::getProperty
an object with magic__call
andArrayAccess
it will check first if the property has an getter before it tries to useArrayAccess
offsetExists
andoffsetGet
.This order is okay unless one implements the magic
__call
method. Then the getter check done viais_callable
on the $object will return true for any input. https://github.com/neos/flow-development-collection/blob/a340ca830356e80f71bcfaebfd983b512d362133/Neos.Utility.ObjectHandling/Classes/ObjectAccess.php#L170so this magic method will be called - although there is a working
ArrayAccess
for this property.Steps to Reproduce
have a php object like:
make it available for testing in eel by retrieving it via Helper. or via:
run:
Expected behavior
following
var_dump
sActual behavior
following
var_dump
sAffected Versions
Flow: 5.3
Solution?
might be breaking, but move the
ArrayAccess
check before trying to use any getters. https://github.com/neos/flow-development-collection/blob/a340ca830356e80f71bcfaebfd983b512d362133/Neos.Utility.ObjectHandling/Classes/ObjectAccess.php#L147