php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73560 Incorrect object to array conversion with numerical properties names
Submitted: 2016-11-18 09:49 UTC Modified: 2016-11-18 10:28 UTC
From: anton at zebooka dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: anton at zebooka dot com
New email:
PHP Version: OS:

 

 [2016-11-18 09:49 UTC] 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)
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-18 10:28 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2016-11-18 10:28 UTC] cmb@php.net
Duplicate of bug #66173.
 [2016-11-18 10:28 UTC] requinix@php.net
-Assigned To: cmb +Assigned To:
 [2016-11-18 10:28 UTC] requinix@php.net
Fixed in 7.2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC