File: igbinary_099.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 (36 lines) | stat: -rw-r--r-- 908 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
34
35
36
--TEST--
Test PHP 8.2 deprecation of creation of dynamic properties
--SKIPIF--
<?php
if (!extension_loaded("igbinary")) print "skip\n";
if (PHP_VERSION_ID < 80200) print "skip php < 8.2\n";
?>
--FILE--
<?php
class C {
}

$c = new C();
$invalidValues = [
    "\x00\x00\x00\x02\x17\x01C\x14\x01\x11\x01a\x06\x08",
    "\x00\x00\x00\x02\x17\x01C\x14\x01\x11\x04\x00*\x00a\x06\x08",
];
foreach ($invalidValues as $invalid) {
    try {
        var_dump(igbinary_unserialize($invalid));
    } catch (Error $e) {
        printf("%s: %s\n", $e::class, $e->getMessage());
    }
}
--EXPECTF--
Deprecated: igbinary_unserialize(): Creation of dynamic property C::$a is deprecated in %sigbinary_099.php on line 12
object(C)#2 (1) {
  ["a"]=>
  int(8)
}

Deprecated: igbinary_unserialize(): Creation of dynamic property C::$a is deprecated in %sigbinary_099.php on line 12
object(C)#2 (1) {
  ["a":protected]=>
  int(8)
}