File: igbinary_enums_3.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 (20 lines) | stat: -rw-r--r-- 470 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
Test unserializing valid enums inferring value
--SKIPIF--
<?php if (PHP_VERSION_ID < 80100) { echo "skip enums requires php 8.1"; } ?>
--FILE--
<?php
enum X: string {
    const Y = 'a';
    case X = self::Y . 'b';
}
$value = urldecode('%00%00%00%02%17%01X%27%0E%00');
var_dump(igbinary_unserialize($value));
$ser = igbinary_serialize(X::X);
echo urlencode($ser), "\n";
var_dump(X::X->value);
?>
--EXPECT--
enum(X::X)
%00%00%00%02%17%01X%27%0E%00
string(2) "ab"