Search
j0ke.net Open Build Service
>
Projects
>
home:netmax
:
rebuilds
>
php4
> php-4.3.9-serialtests.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File php-4.3.9-serialtests.patch of Package php4
--- php-4.3.9/ext/standard/tests/serialize/bug14293.phpt +++ php-4.3.9/ext/standard/tests/serialize/bug14293.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #14293 (serialize() and __sleep()) +--FILE-- +<?php +class t +{ + function t() + { + $this->a = 'hello'; + } + + function __sleep() + { + echo "__sleep called\n"; + return array('a','b'); + } +} + +$t = new t(); +$data = serialize($t); +echo "$data\n"; +$t = unserialize($data); +var_dump($t); + +?> +--EXPECTF-- +__sleep called +O:1:"t":2:{s:1:"a";s:5:"hello";s:1:"b";N;} +object(t)(2) { + ["a"]=> + string(5) "hello" + ["b"]=> + NULL +} --- php-4.3.9/ext/standard/tests/serialize/bug25378.phpt.serialtests +++ php-4.3.9/ext/standard/tests/serialize/bug25378.phpt @@ -3,7 +3,57 @@ --FILE-- <?php var_dump(unserialize("s:-1:\"\";")); +var_dump(unserialize("i:823")); +var_dump(unserialize("O:8:\"stdClass :0:{}")); +var_dump(unserialize("O:8:\"stdClass\"+0:{}")); +var_dump(unserialize("O:1000:\"stdClass\":0:{}")); +var_dump(unserialize("a:2:{i:0;s:2:\"12\":")); +var_dump(unserialize("a:2:{i:0;s:2:\"12\";i:1;s:3000:\"123")); +var_dump(unserialize("a:2:{i:0;s:2:\"12\"+i:1;s:3:\"123\";}")); +var_dump(unserialize("a:2:{i:0;s:2:\"12\";i:1;s:3:\"123\";")); +var_dump(unserialize("s:3000:\"123\";")); +var_dump(unserialize("s:3000:\"123")); +var_dump(unserialize("s:3:\"123;")); +var_dump(unserialize("s:0:\"123\";")); ?> +===DONE=== --EXPECTF-- -Notice: unserialize(): Error at offset 0 of 8 bytes in %s on line %d +Notice: unserialize(): Error at offset 0 of 8 bytes in %sbug25378.php on line %d bool(false) + +Notice: unserialize(): Error at offset 0 of 5 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 13 of 19 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 14 of 19 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 2 of 22 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 17 of 18 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 24 of 33 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 17 of 33 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 33 of 32 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 2 of 13 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 2 of 11 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 8 of 9 bytes in %sbug25378.php on line %d +bool(false) + +Notice: unserialize(): Error at offset 5 of 10 bytes in %sbug25378.php on line %d +bool(false) +===DONE=== --- php-4.3.9/ext/standard/tests/serialize/bug28325.phpt +++ php-4.3.9/ext/standard/tests/serialize/bug28325.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #28325 (Problem in serialisation of circular references) +--FILE-- +<?php +class a { + var $b; +} +class b { + var $c; +} +class c { + var $d; +} +$a = new a(); +$a->b = new b(); +$a->b->c = new c(); +$a->b->c->d = $a; +var_dump(unserialize(serialize($a))); +?> +--EXPECT-- +object(a)(1) { + ["b"]=> + object(b)(1) { + ["c"]=> + object(c)(1) { + ["d"]=> + object(a)(1) { + ["b"]=> + object(b)(1) { + ["c"]=> + object(c)(1) { + ["d"]=> + NULL + } + } + } + } + } +} --- php-4.3.9/ext/standard/tests/serialize/001.phpt.serialtests +++ php-4.3.9/ext/standard/tests/serialize/001.phpt @@ -1,7 +1,5 @@ --TEST-- serialize()/unserialize()/var_dump() ---POST-- ---GET-- --FILE-- <?php class t @@ -14,11 +12,16 @@ class s { + var $a; + var $b; + var $c; + function s() { $this->a = "hallo"; $this->b = "php"; $this->c = "world"; + $this->d = "!"; } function __sleep() @@ -94,9 +97,11 @@ __sleep called O:1:"s":2:{s:1:"a";s:5:"hallo";s:1:"c";s:5:"world";} __wakeup called -object(s)(2) { +object(s)(3) { ["a"]=> string(5) "hallo" + ["b"]=> + NULL ["c"]=> string(5) "world" } --- php-4.3.9/ext/standard/tests/serialize/002.phpt.serialtests +++ php-4.3.9/ext/standard/tests/serialize/002.phpt @@ -1,36 +1,44 @@ --TEST-- -serialize() (Bug #14293) ---POST-- ---GET-- +Bug #25378 (unserialize() crashes with invalid data) --FILE-- <?php -class t -{ - function t() - { - $this->a = 'hello'; - } - - function __sleep() - { - echo "__sleep called\n"; - return array('a','b'); - } -} - -$t = new t(); -$data = serialize($t); -echo "$data\n"; -$t = unserialize($data); -var_dump($t); - +var_dump(unserialize('b:0;')); +var_dump(unserialize('b:1;')); +var_dump(unserialize('i:823;')); +var_dump(unserialize('s:0:"";')); +var_dump(unserialize('s:3:"foo";')); +var_dump(unserialize('a:1:{i:0;s:2:"12";}')); +var_dump(unserialize('a:2:{i:0;a:0:{}i:1;a:0:{}}')); +var_dump(unserialize('a:3:{i:0;s:3:"foo";i:1;s:3:"bar";i:2;s:3:"baz";}')); +var_dump(unserialize('O:8:"stdClass":0:{}')); ?> +===DONE=== --EXPECT-- -__sleep called -O:1:"t":2:{s:1:"a";s:5:"hello";s:1:"b";N;} -object(t)(2) { - ["a"]=> - string(5) "hello" - ["b"]=> - NULL +bool(false) +bool(true) +int(823) +string(0) "" +string(3) "foo" +array(1) { + [0]=> + string(2) "12" } +array(2) { + [0]=> + array(0) { + } + [1]=> + array(0) { + } +} +array(3) { + [0]=> + string(3) "foo" + [1]=> + string(3) "bar" + [2]=> + string(3) "baz" +} +object(stdClass)(0) { +} +===DONE=== --- php-4.3.9/ext/standard/tests/serialize/003.phpt.serialtests +++ php-4.3.9/ext/standard/tests/serialize/003.phpt @@ -0,0 +1,25 @@ +--TEST-- +unserialize() floats with E notation (#18654) +--INI-- +precision=12 +serialize_precision=100 +--FILE-- +<?php +foreach(array(1e2, 5.2e25, 85.29e-23, 9e-9) AS $value) { + echo ($ser = serialize($value))."\n"; + var_dump(unserialize($ser)); + echo "\n"; +} +?> +--EXPECTREGEX-- +d:100; +float\(100\) + +d:5\.2E\+25; +float\(5\.2E\+25\) + +d:8\.52[89][0-9]+E-22; +float\(8\.529E-22\) + +d:9\.[0-9]*E-9; +float\(9\.0E-9\) --- php-4.3.9/ext/standard/tests/serialize/004.phpt.serialtests +++ php-4.3.9/ext/standard/tests/serialize/004.phpt @@ -0,0 +1,33 @@ +--TEST-- +serialize()/unserialize() floats in array. +--INI-- +precision=12 +serialize_precision=100 +--FILE-- +<?php +error_reporting (E_ALL); +$a = array(4); +$str = serialize($a); +print('Serialized array: '.$str."\n"); +$b = unserialize($str); +print('Unserialized array: '); +var_dump($b); +print("\n"); +$str = serialize(array(4.5)); +print('Serialized array: '.$str."\n"); +$b = unserialize($str); +print('Unserialized array: ') ; +var_dump($b); +?> +--EXPECT-- +Serialized array: a:1:{i:0;i:4;} +Unserialized array: array(1) { + [0]=> + int(4) +} + +Serialized array: a:1:{i:0;d:4.5;} +Unserialized array: array(1) { + [0]=> + float(4.5) +} --- php-4.3.9/ext/standard/tests/serialize/bug21957.phpt.serialtests +++ php-4.3.9/ext/standard/tests/serialize/bug21957.phpt @@ -0,0 +1,49 @@ +--TEST-- +Bug #21957 (serialize() mangles objects with __sleep) +--FILE-- +<?php +class test +{ + var $a, $b; + + function test() + { + $this->a = 7; + $this->b = 2; + } + + function __sleep() + { + $this->b = 0; + } +} + +$t['one'] = 'ABC'; +$t['two'] = new test(); + +var_dump($t); + +$s = @serialize($t); +echo $s . "\n"; + +var_dump(unserialize($s)); +?> +--EXPECT-- +array(2) { + ["one"]=> + string(3) "ABC" + ["two"]=> + object(test)(2) { + ["a"]=> + int(7) + ["b"]=> + int(2) + } +} +a:2:{s:3:"one";s:3:"ABC";s:3:"two";N;} +array(2) { + ["one"]=> + string(3) "ABC" + ["two"]=> + NULL +} --- php-4.3.9/ext/standard/tests/serialize/bug23298.phpt.serialtests +++ php-4.3.9/ext/standard/tests/serialize/bug23298.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #23298 (serialize() and floats/doubles) +--INI-- +serialize_precision=100 +--FILE-- +<?php + ini_set('precision', 12); + $foo = 1.428571428571428647642857142; + $bar = unserialize(serialize($foo)); + var_dump(($foo === $bar)); +?> +--EXPECT-- +bool(true) --- php-4.3.9/ext/standard/tests/serialize/bug24063.phpt.serialtests +++ php-4.3.9/ext/standard/tests/serialize/bug24063.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #24063 (serialize() missing 0 after the . on scientific notation) +--INI-- +serialize_precision=100 +precision=12 +--FILE-- +<?php +$v = 1; +for ($i = 1; $i < 10; $i++) { + $v /= 10; + echo "{$v} ".unserialize(serialize($v))."\n"; +} +?> +--EXPECT-- +0.1 0.1 +0.01 0.01 +0.001 0.001 +0.0001 0.0001 +1E-05 1E-05 +1E-06 1E-06 +1E-07 1E-07 +1E-08 1E-08 +1E-09 1E-09