- Notifications
You must be signed in to change notification settings - Fork8k
Closed
Labels
Description
Description
The following code: (seehttps://3v4l.org/jnJJe#v8.4.4)
<?phpfinalclass SomeAction{publicfunction__construct(public ?string$powerOfAttorneyDate =null { set =>$value ==='' ?null :$value; }, ) { }}$data =newSomeAction('2025-01-01');echo"powerOfAttorneyDate is included when printing the obj:\n";echoprint_r($data,true);echo"powerOfAttorneyDate is missing (bug) when using get_object_vars:\n";echoprint_r(get_object_vars($data),true);echo"powerOfAttorneyDate is included when using foreach on the object:\n";foreach ($dataas$name =>$value) {echo$name .' =>' .$value;}
Resulted in this output:
powerOfAttorneyDate is included when printing the obj:SomeAction Object( [powerOfAttorneyDate] => 2025-01-01)powerOfAttorneyDate is missing (bug) when using get_object_vars:Array()powerOfAttorneyDate is included when using foreach on the object:powerOfAttorneyDate => 2025-01-01
But I expected this output instead:
powerOfAttorneyDate is included when printing the obj:SomeAction Object( [powerOfAttorneyDate] => 2025-01-01)powerOfAttorneyDate is missing (bug) when using get_object_vars:Array( [powerOfAttorneyDate] => 2025-01-01)powerOfAttorneyDate is included when using foreach on the object:powerOfAttorneyDate => 2025-01-01
PHP Version
PHP 8.4.4
Operating System
No response