File: igbinary_bug54662.phpt

package info (click to toggle)
php-igbinary 3.2.16-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,024 kB
  • sloc: ansic: 3,373; xml: 1,106; pascal: 10; makefile: 2; php: 2; sh: 1
file content (26 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--TEST--
Nested objects cause segfault, php bug #54662
--SKIPIF--
<?php if (!extension_loaded("igbinary")) print "skip"; ?>
--FILE--
<?php
/**
 * Proof of concept, segmentation fault (spl_array.c/igbinary.c)
 * when using nested objects.
 *
 * @author Aleksey Korzun
 */

class Storage {
    public $storage = "a string";
}

$collection = new ArrayObject;
$collection->append(new Storage);

$ser = igbinary_serialize($collection);
$new_collection = igbinary_unserialize($ser);

var_dump($new_collection[0]->storage);
--EXPECT--
string(8) "a string"