Annotation of embedaddon/php/ext/standard/tests/array/bug39576.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #39576 (array_walk() doesn't separate userdata zval)
                      3: --FILE--
                      4: <?php
                      5: 
                      6: class Test {
                      7: 
                      8:        public $_table = '';
                      9:        public $_columns = array ();
                     10:        public $_primary = array ();
                     11: 
                     12: }
                     13: 
                     14: $test = new Test ();
                     15: $test->name = 'test';
                     16: $test->_columns['name'] = new stdClass;
                     17: 
                     18: function test ($value, $column, &$columns) {}
                     19: 
                     20: array_walk (
                     21:        get_object_vars ($test),
                     22:        'test',
                     23:        $test->_columns
                     24: );
                     25: 
                     26: var_dump($test);
                     27: 
                     28: array_intersect_key (
                     29:        get_object_vars ($test),
                     30:        $test->_primary
                     31: );
                     32: 
                     33: echo "Done\n";
                     34: ?>
                     35: --EXPECTF--    
                     36: Strict Standards: Only variables should be passed by reference in %s on line %d
                     37: object(Test)#%d (4) {
                     38:   ["_table"]=>
                     39:   string(0) ""
                     40:   ["_columns"]=>
                     41:   array(1) {
                     42:     ["name"]=>
                     43:     object(stdClass)#%d (0) {
                     44:     }
                     45:   }
                     46:   ["_primary"]=>
                     47:   array(0) {
                     48:   }
                     49:   ["name"]=>
                     50:   string(4) "test"
                     51: }
                     52: Done

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