php-src/ext/spl/tests/arrayObject___construct_basic7.phpt
Andrea Faulds a0502b89a6 Convert numeric keys in object/array casts
RFC: https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts

This converts key types as appropriate in object to array and array to object
casts, as well as in get_object_vars().
2016-11-14 18:20:45 +00:00

35 lines
479 B
PHP

--TEST--
SPL: ArrayObject::__construct: Using object with shared properties
--FILE--
<?php
$y = 2;
$x = 1;
$a = array($y, $x);
$o = (object)$a;
$ao = new ArrayObject($o);
$ao->asort();
var_dump($a, $o, $ao);
?>
--EXPECT--
array(2) {
[0]=>
int(2)
[1]=>
int(1)
}
object(stdClass)#1 (2) {
["1"]=>
int(1)
["0"]=>
int(2)
}
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
object(stdClass)#1 (2) {
["1"]=>
int(1)
["0"]=>
int(2)
}
}