Bug #73560 [Opn->Dup]: Incorrect object to array conversion with numerical properties names

From: Date: Fri, 18 Nov 2016 10:28:23 +0000
Subject: Bug #73560 [Opn->Dup]: Incorrect object to array conversion with numerical properties names
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205446@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73560&edit=1

 ID:                 73560
 Updated by:         cmb@php.net
 Reported by:        anton at zebooka dot com
 Summary:            Incorrect object to array conversion with numerical
                     properties names
-Status:             Open
+Status:             Duplicate
 Type:               Bug
 Package:            *General Issues
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Duplicate of bug #66173.


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#205446) next »