summaryrefslogtreecommitdiff
path: root/ext/standard/tests/serialize
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2004-01-25 12:03:25 +0000
committerSVN Migration <svn@php.net>2004-01-25 12:03:25 +0000
commit22476b36ce621bdd115493bab84cbe706e422a7c (patch)
tree1124d1c5af68860a78c2252bb0dac63c9f18156e /ext/standard/tests/serialize
parenteb7aca4ea896b09cb9afc2466a46f4720acc4a4e (diff)
downloadphp-git-php_ibase_before_split.tar.gz
This commit was manufactured by cvs2svn to create tagphp_ibase_before_split
'php_ibase_before_split'.
Diffstat (limited to 'ext/standard/tests/serialize')
-rw-r--r--ext/standard/tests/serialize/001.phpt122
-rw-r--r--ext/standard/tests/serialize/003.phpt25
-rw-r--r--ext/standard/tests/serialize/004.phpt33
-rw-r--r--ext/standard/tests/serialize/bug14293.phpt34
-rw-r--r--ext/standard/tests/serialize/bug21957.phpt49
-rw-r--r--ext/standard/tests/serialize/bug23298.phpt13
-rw-r--r--ext/standard/tests/serialize/bug24063.phpt23
-rw-r--r--ext/standard/tests/serialize/bug25378.phpt9
-rwxr-xr-xext/standard/tests/serialize/bug26762.phpt27
9 files changed, 0 insertions, 335 deletions
diff --git a/ext/standard/tests/serialize/001.phpt b/ext/standard/tests/serialize/001.phpt
deleted file mode 100644
index 68352a9393..0000000000
--- a/ext/standard/tests/serialize/001.phpt
+++ /dev/null
@@ -1,122 +0,0 @@
---TEST--
-serialize()/unserialize()/var_dump()
---POST--
---GET--
---FILE--
-<?php
-class t
-{
- function t()
- {
- $this->a = "hallo";
- }
-}
-
-class s
-{
- public $a;
- public $b;
- public $c;
-
- function s()
- {
- $this->a = "hallo";
- $this->b = "php";
- $this->c = "world";
- $this->d = "!";
- }
-
- function __sleep()
- {
- echo "__sleep called\n";
- return array("a","c");
- }
-
- function __wakeup()
- {
- echo "__wakeup called\n";
- }
-}
-
-
-echo serialize(NULL)."\n";
-echo serialize((bool) true)."\n";
-echo serialize((bool) false)."\n";
-echo serialize(1)."\n";
-echo serialize(0)."\n";
-echo serialize(-1)."\n";
-echo serialize(2147483647)."\n";
-echo serialize(-2147483647)."\n";
-echo serialize(1.123456789)."\n";
-echo serialize(1.0)."\n";
-echo serialize(0.0)."\n";
-echo serialize(-1.0)."\n";
-echo serialize(-1.123456789)."\n";
-echo serialize("hallo")."\n";
-echo serialize(array(1,1.1,"hallo",NULL,true,array()))."\n";
-
-$t = new t();
-$data = serialize($t);
-echo "$data\n";
-$t = unserialize($data);
-var_dump($t);
-
-$t = new s();
-$data = serialize($t);
-echo "$data\n";
-$t = unserialize($data);
-var_dump($t);
-
-$a = array("a" => "test");
-$a[ "b" ] = &$a[ "a" ];
-var_dump($a);
-$data = serialize($a);
-echo "$data\n";
-$a = unserialize($data);
-var_dump($a);
-?>
---EXPECTF--
-N;
-b:1;
-b:0;
-i:1;
-i:0;
-i:-1;
-i:2147483647;
-i:-2147483647;
-d:1.123456789000000011213842299184761941432952880859375;
-d:1;
-d:0;
-d:-1;
-d:-1.123456789000000011213842299184761941432952880859375;
-s:5:"hallo";
-a:6:{i:0;i:1;i:1;d:1.100000000000000088817841970012523233890533447265625;i:2;s:5:"hallo";i:3;N;i:4;b:1;i:5;a:0:{}}
-O:1:"t":1:{s:1:"a";s:5:"hallo";}
-object(t)#%d (1) {
- ["a"]=>
- string(5) "hallo"
-}
-__sleep called
-O:1:"s":2:{s:1:"a";s:5:"hallo";s:1:"c";s:5:"world";}
-__wakeup called
-object(s)#%d (3) {
- ["a"]=>
- string(5) "hallo"
- ["b"]=>
- NULL
- ["c"]=>
- string(5) "world"
-}
-array(2) {
- ["a"]=>
- &string(4) "test"
- ["b"]=>
- &string(4) "test"
-}
-a:2:{s:1:"a";s:4:"test";s:1:"b";R:2;}
-array(2) {
- ["a"]=>
- &string(4) "test"
- ["b"]=>
- &string(4) "test"
-}
diff --git a/ext/standard/tests/serialize/003.phpt b/ext/standard/tests/serialize/003.phpt
deleted file mode 100644
index 173f57b72c..0000000000
--- a/ext/standard/tests/serialize/003.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---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\)
diff --git a/ext/standard/tests/serialize/004.phpt b/ext/standard/tests/serialize/004.phpt
deleted file mode 100644
index a4a7c68d6f..0000000000
--- a/ext/standard/tests/serialize/004.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---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)
-}
diff --git a/ext/standard/tests/serialize/bug14293.phpt b/ext/standard/tests/serialize/bug14293.phpt
deleted file mode 100644
index 976eeffc0e..0000000000
--- a/ext/standard/tests/serialize/bug14293.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---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)#%d (2) {
- ["a"]=>
- string(5) "hello"
- ["b"]=>
- NULL
-}
diff --git a/ext/standard/tests/serialize/bug21957.phpt b/ext/standard/tests/serialize/bug21957.phpt
deleted file mode 100644
index 29eeb2ee6c..0000000000
--- a/ext/standard/tests/serialize/bug21957.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Bug #21957 (serialize() mangles objects with __sleep)
---FILE--
-<?php
-class test
-{
- public $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)#1 (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
-}
diff --git a/ext/standard/tests/serialize/bug23298.phpt b/ext/standard/tests/serialize/bug23298.phpt
deleted file mode 100644
index a5305cf37c..0000000000
--- a/ext/standard/tests/serialize/bug23298.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---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)
diff --git a/ext/standard/tests/serialize/bug24063.phpt b/ext/standard/tests/serialize/bug24063.phpt
deleted file mode 100644
index e1cdfecf55..0000000000
--- a/ext/standard/tests/serialize/bug24063.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---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
diff --git a/ext/standard/tests/serialize/bug25378.phpt b/ext/standard/tests/serialize/bug25378.phpt
deleted file mode 100644
index e59044002f..0000000000
--- a/ext/standard/tests/serialize/bug25378.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Bug #25378 (unserialize() crashes with invalid data)
---FILE--
-<?php
-var_dump(unserialize("s:-1:\"\";"));
-?>
---EXPECTF--
-Notice: unserialize(): Error at offset 0 of 8 bytes in %s on line %d
-bool(false)
diff --git a/ext/standard/tests/serialize/bug26762.phpt b/ext/standard/tests/serialize/bug26762.phpt
deleted file mode 100755
index 3011bb602c..0000000000
--- a/ext/standard/tests/serialize/bug26762.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Bug #26762 (unserialize() produces lowercase classnames)
---SKIPIF--
-<?php
- if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed');
- if (class_exists('autoload_root')) die('skip Autoload test classes exist already');
-?>
---FILE--
-<?php
-
-ini_set('unserialize_callback_func','check');
-
-function check($name) {
- var_dump($name);
- throw new exception;
-}
-
-try {
- @unserialize('O:3:"FOO":0:{}');
-}
-catch (Exception $e) {
- /* ignore */
-}
-
-?>
---EXPECTF--
-string(3) "FOO"