You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
➜ sf-5-4 git:(main) ✗ php test.php
SimpleXMLElement {#2
+"message": SimpleXMLElement {#20}
}
PHP Fatal error: Uncaught Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException: Could not determine access typeforproperty "message"in class "SimpleXMLElement". in /sf-5-4/vendor/symfony/property-access/PropertyAccessor.php:604
Stack trace:
#0 /sf-5-4/vendor/symfony/property-access/PropertyAccessor.php(175): Symfony\Component\PropertyAccess\PropertyAccessor->writeProperty(Array, 'message', 123)#1 /sf-5-4/test.php(20): Symfony\Component\PropertyAccess\PropertyAccessor->setValue(Object(SimpleXMLElement), 'message', 123)#2 {main}
thrown in /sf-5-4/vendor/symfony/property-access/PropertyAccessor.php on line 604
Possible Solution
No response
Additional Context
In our use case we use the component to parse XML API responses, and sometimes need to make adjustments to certain node elements.
For the time being we can obviously adjust the code to set the property values directly (i.e. $xml->property = 'value'), however would be great if this can be fixed as it simplifies our implementation.
The text was updated successfully, but these errors were encountered:
Symfony version(s) affected
v5.4+
Description
The
PropertyAccess
component on version v5.4+ no longer can set a value to a SimpleXMLElement class property dynamically.I noticed there were some changes made on #37622 and #44419, however this issue is still happening for the SimpleXMLElement class at least.
How to reproduce
Code snippet:
Result on v4.4.44:
Result on v5.4.26:
Possible Solution
No response
Additional Context
In our use case we use the component to parse XML API responses, and sometimes need to make adjustments to certain node elements.
For the time being we can obviously adjust the code to set the property values directly (i.e.
$xml->property = 'value'
), however would be great if this can be fixed as it simplifies our implementation.The text was updated successfully, but these errors were encountered: