Bug #73560 [Dup]: Incorrect object to array conversion with numerical properties names
Edit report at https://bugs.php.net/bug.php?id=73560&edit=1
ID: 73560
Updated by: requinix@php.net
Reported by: anton at zebooka dot com
Summary: Incorrect object to array conversion with numerical
properties names
Status: Duplicate
Type: Bug
Package: *General Issues
PHP Version: Irrelevant
-Assigned To: cmb
+Assigned To:
Block user comment: N
Private report: N
New Comment:
Fixed in 7.2.
Previous Comments:
------------------------------------------------------------------------
[2016-11-18 10:28:23] cmb@php.net
Duplicate of bug #66173.
------------------------------------------------------------------------
[2016-11-18 09:49:09] anton at zebooka dot com
Description:
------------
This bug is so old. I had reported it once, but couple of developers could not read carefully the
description and closed it as bogus, still it is a bug.
Test script:
---------------
$o = new \stdClass();
$o->{123} = 456;
$a = (array)$o;
$a[123] = 777;
var_dump($a);
Expected result:
----------------
array(1) {
[123]=>
int(777)
}
Actual result:
--------------
array(2) {
["123"]=>
int(456)
[123]=>
int(777)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73560&edit=1
Thread (3 messages)