1--TEST-- 2get_object_vars() - ensure references are preserved 3--FILE-- 4<?php 5/* Prototype : proto array get_object_vars(object obj) 6 * Description: Returns an array of object properties 7 * Source code: Zend/zend_builtin_functions.c 8 * Alias to functions: 9 */ 10 11$obj = new stdClass; 12var_dump(get_object_vars($obj)); 13 14$a='original.a'; 15$obj->ref = &$a; 16$obj->val = $a; 17 18$arr = get_object_vars($obj); 19var_dump($arr); 20 21$arr['ref'] = 'changed.ref'; 22$arr['val'] = 'changed.val'; 23 24var_dump($arr, $obj, $a); 25?> 26--EXPECTF-- 27array(0) { 28} 29array(2) { 30 ["ref"]=> 31 &string(10) "original.a" 32 ["val"]=> 33 string(10) "original.a" 34} 35array(2) { 36 ["ref"]=> 37 &string(11) "changed.ref" 38 ["val"]=> 39 string(11) "changed.val" 40} 41object(stdClass)#1 (2) { 42 ["ref"]=> 43 &string(11) "changed.ref" 44 ["val"]=> 45 string(10) "original.a" 46} 47string(11) "changed.ref" 48