Bug #81467 [Com]: (object) casting of array should validate keynames

From: Date: Wed, 22 Sep 2021 20:46:32 +0000
Subject: Bug #81467 [Com]: (object) casting of array should validate keynames
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236760@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81467&edit=1 ID: 81467 Comment by: dharman@php.net Reported by: wyattbiker at gmail dot com Summary: (object) casting of array should validate keynames Status: Open Type: Bug Package: Class/Object related Operating System: mac os x PHP Version: 8.0.10 Block user comment: N Private report: N New Comment: What is invalid about property name "20"? I appreciate you filing the bug report, but I fail to see where the bug is. The created object is a valid object with valid property names. I can access the property without any problem: <?php $x=(object) array('20'=>'abc'); echo $x->{20}; // Outputs: abc Can you explain what exactly, do you consider a bug? Previous Comments: ------------------------------------------------------------------------ [2021-09-22 20:36:33] wyattbiker at gmail dot com Description: ------------ When casting an associative array to an object it should verify that in fact it is creating valid object property names. E.g.this should produce an error. $x=(object) array('20'=>'abc'); echo $x->20; // << ERROR obviously Test script: --------------- $x=(object) array('x20'=>'abc'); echo $x->x20; // OK $x=(object) array('20'=>'abc'); echo $x->20; // << ERROR obviously ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81467&edit=1

« previous php.bugs (#236760) next »