Bug #61655 [Com]: Unable to access key in array cast from object

From: Date: Wed, 04 Jan 2023 13:36:52 +0000
Subject: Bug #61655 [Com]: Unable to access key in array cast from object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243331@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61655&edit=1 ID: 61655 Comment by: ksla at wp dot pl Reported by: phpbugs at deep-freeze dot ca Summary: Unable to access key in array cast from object Status: Closed Type: Bug Package: Arrays related Operating System: RedHat PHP Version: 5.3.10 Assigned To: ajf Block user comment: N Private report: N New Comment: www.wp.pl Previous Comments: ------------------------------------------------------------------------ [2023-01-04 10:49:56] apple0478 at interia dot pl Thank you for the report, it is hard here in Dubai to get such a great knowledge! ------------------------------------------------------------------------ [2016-11-14 18:30:51] ajf@php.net The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Fixed by: https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts ------------------------------------------------------------------------ [2016-08-08 12:17:57] cmb@php.net Related To: Bug #71208 ------------------------------------------------------------------------ [2012-04-09 03:22:01] laruence@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This is a documented behavior, plz lok at: http://www.php.net/manual/en/language.types.array.php Fixing that implies a perfomance decrease. ------------------------------------------------------------------------ [2012-04-09 02:52:20] reeze dot xia at gmail dot com Hi, in a object property lookup by name always in string, but in array numeric string(like "22200" ) key will transform to numeric but not a string anymore. when conversion internal HashTable did't changed so after conversion, key lookup will fail. as you posted: array(1) { ["804496778"]=> string(5) "Hello" } the key is string but not number. if you do like this: $array["1000"] = "value" var_dump($array); array(1) { [1000]=> string(5) "value" } see ? "1000" changed to 1000. I've post a discussion about this in internal list. http://marc.info/?l=php- internals&m=133390323614733&w=2 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=61655 -- Edit this bug report at https://bugs.php.net/bug.php?id=61655&edit=1

« previous php.bugs (#243331) next »