File: igbinary_089.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 (33 lines) | stat: -rw-r--r-- 911 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
--TEST--
Test serializing string > 4G
--INI--
memory_limit=15G
display_errors=stderr
error_reporting=E_ALL
--CONFLICTS--
high_memory
--SKIPIF--
<?php
if (!extension_loaded("igbinary")) print "skip\n";
if (PHP_INT_SIZE <= 4) { print "skip requires 64-bit\n"; }
if (!getenv('IGBINARY_HIGH_MEMORY_TESTS')) { print "skip requires IGBINARY_HIGH_MEMORY_TESTS=1\n"; }
?>
--FILE--
<?php
ini_set('memory_limit', '15G');
$ser = igbinary_serialize(str_repeat('*', 4200000000));
echo "len=" . strlen($ser) . "\n";
echo bin2hex(substr($ser, 0, 20)) . "\n";
$unser = igbinary_unserialize($ser);
unset($ser);
var_dump($unser === str_repeat('*', 4200000000));
$ser_invalid = hex2bin('0000000213fa56ea002a');
var_dump(igbinary_unserialize($ser_invalid));

?>
--EXPECTF--
len=4200000009
0000000213fa56ea002a2a2a2a2a2a2a2a2a2a2a
bool(true)
Warning: igbinary_unserialize_chararray: end-of-data in %sigbinary_089.php on line 10
NULL