Annotation of embedaddon/php/ext/standard/tests/class_object/get_object_vars_variation_002.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: get_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;
                     12: var_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);
                     19: var_dump($arr);
                     20: 
                     21: $arr['ref'] = 'changed.ref';
                     22: $arr['val'] = 'changed.val';
                     23: 
                     24: var_dump($arr, $obj, $a);
                     25: ?>
                     26: --EXPECTF--
                     27: array(0) {
                     28: }
                     29: array(2) {
                     30:   ["ref"]=>
                     31:   &string(10) "original.a"
                     32:   ["val"]=>
                     33:   string(10) "original.a"
                     34: }
                     35: array(2) {
                     36:   ["ref"]=>
                     37:   &string(11) "changed.ref"
                     38:   ["val"]=>
                     39:   string(11) "changed.val"
                     40: }
                     41: object(stdClass)#1 (2) {
                     42:   ["ref"]=>
                     43:   &string(11) "changed.ref"
                     44:   ["val"]=>
                     45:   string(10) "original.a"
                     46: }
                     47: string(11) "changed.ref"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>