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
When attempting to hydrate an object that only has a few properties available compared to the data coming in, PHP 8.2 throws this deprecation error: Deprecated: Creation of dynamic property Paasch\Security\Security\Entity\Auth::$error is deprecated in /app/vendor/laminas/laminas-hydrator/src/ObjectPropertyHydrator.php on line 83
Current behavior
When hydrating an object, if the object doesn't have the properties for all of the data coming in and it doesn't have the __set magic method, it ends up throwing the deprecation error.
How to reproduce
Create a class that only has a single public property, $prop
Create an instance of the previous class, $myClassInst
Create an local variable that is an array of ['prop'=> 'value1', 'another' => 'value2'] as $ar
Create an instance of the ObjectPropertyHydrator class. $myHydrator
Try to hydrate it with $myHydrator: $myHydrator->hydrate($ar, $myClassInst);
A deprecation error is thrown: Creation of dynamic property MyClass::$another is deprecated in /app/vendor/laminas/laminas-hydrator/src/ObjectPropertyHydrator.php on line 83
Expected behavior
I would expect that if the property that it is trying to hydrate doesn't exist and there is no __set magic method on the class hierarchy, then it should skip hydrating that property.
The text was updated successfully, but these errors were encountered:
I would expect that if the property that it is trying to hydrate doesn't exist and there is no __set magic method on the class hierarchy, then it should skip hydrating that property.
This means a BC break, because this library still supports version 8.0 and 8.1 and these versions allow the dynamic creation of properties:
If trying to assign to a non-existent property on an object, PHP will automatically create a corresponding property.
Bug Report
Summary
When attempting to hydrate an object that only has a few properties available compared to the data coming in, PHP 8.2 throws this deprecation error:
Deprecated: Creation of dynamic property Paasch\Security\Security\Entity\Auth::$error is deprecated in /app/vendor/laminas/laminas-hydrator/src/ObjectPropertyHydrator.php on line 83
Current behavior
When hydrating an object, if the object doesn't have the properties for all of the data coming in and it doesn't have the
__set
magic method, it ends up throwing the deprecation error.How to reproduce
$prop
$myClassInst
['prop'=> 'value1', 'another' => 'value2']
as$ar
$myHydrator
$myHydrator->hydrate($ar, $myClassInst);
A deprecation error is thrown:
Creation of dynamic property MyClass::$another is deprecated in /app/vendor/laminas/laminas-hydrator/src/ObjectPropertyHydrator.php on line 83
Expected behavior
I would expect that if the property that it is trying to hydrate doesn't exist and there is no
__set
magic method on the class hierarchy, then it should skip hydrating that property.The text was updated successfully, but these errors were encountered: