|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-09-22 20:36 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 22:00:01 2025 UTC |
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?