Annotation of embedaddon/php/ext/wddx/tests/bug48562.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Bug #48562 (Reference recursion causes segfault when used in wddx_serialize_vars())
3: --SKIPIF--
4: <?php
5: if (!extension_loaded('wddx')) {
6: die('skip. wddx not available');
7: }
8: ?>
9: --FILE--
10: <?php
11:
12: $foo = 'bar';
13:
14: $a['x'] = 'foo';
15: $a['x'] = &$a;
16:
17: var_dump(wddx_serialize_vars($a));
18:
1.1.1.2 ! misho 19: // replace $a - the recursion detection seems to be causing $a to be not an array here, maybe its internally a pointer
! 20: // replacing $a with a new array() allows this test to still check for 2 things
! 21: // 1. recursion detection in &$a;
! 22: // 2. recursion detection in adding $a to itself and then serializing $a
! 23: // the one thing the test won't check is using $a as an array after doing &$a; which isn't really a wddx problem.
! 24: $a = array();
1.1 misho 25: $a['x'] = 'foo';
26: $a['x'] = $a;
27:
28: var_dump(wddx_serialize_vars($a));
29:
30: ?>
31: --EXPECTF--
32: Warning: wddx_serialize_vars(): recursion detected in %s on line %d
33: string(78) "<wddxPacket version='1.0'><header/><data><struct></struct></data></wddxPacket>"
34: string(120) "<wddxPacket version='1.0'><header/><data><struct><var name='foo'><string>bar</string></var></struct></data></wddxPacket>"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>