summaryrefslogtreecommitdiff
path: root/ext/standard/tests
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:27 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:27 -0400
commit2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (patch)
tree41ccc042009cba53e4ce43e727fcba4c1cfbf7f3 /ext/standard/tests
parentd29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (diff)
downloadphp-upstream/5.2.2.tar.gz
Imported Upstream version 5.2.2upstream/5.2.2
Diffstat (limited to 'ext/standard/tests')
-rw-r--r--ext/standard/tests/array/array_diff_key.phpt14
-rw-r--r--ext/standard/tests/array/array_flip.phpt21
-rw-r--r--ext/standard/tests/array/array_intersect_key.phpt10
-rw-r--r--ext/standard/tests/array/array_key_exists.phpt40
-rw-r--r--ext/standard/tests/array/array_pad.phpt101
-rw-r--r--ext/standard/tests/array/array_rand.phpt51
-rw-r--r--ext/standard/tests/array/array_sum.phpt3
-rw-r--r--ext/standard/tests/array/array_unshift.phpt40
-rw-r--r--ext/standard/tests/array/array_user_key_compare.phpt19
-rw-r--r--ext/standard/tests/array/array_values.phpt47
-rw-r--r--ext/standard/tests/array/bug30074.phpt15
-rw-r--r--ext/standard/tests/array/bug33382.phpt2
-rw-r--r--ext/standard/tests/array/bug36975.phpt62
-rw-r--r--ext/standard/tests/array/bug39576.phpt52
-rw-r--r--ext/standard/tests/array/bug40191.phpt25
-rw-r--r--ext/standard/tests/array/bug40709.phpt28
-rw-r--r--ext/standard/tests/array/bug41121.phpt128
-rw-r--r--ext/standard/tests/array/compact.phpt60
-rw-r--r--ext/standard/tests/array/locale_sort.phpt4
-rw-r--r--ext/standard/tests/assert/assert02.phpt4
-rw-r--r--ext/standard/tests/assert/assert03.phpt33
-rw-r--r--ext/standard/tests/assert/assert04.phpt41
-rw-r--r--ext/standard/tests/file/bug22414.phpt9
-rw-r--r--ext/standard/tests/file/bug24313.phpt6
-rw-r--r--ext/standard/tests/file/bug26615.phpt6
-rw-r--r--ext/standard/tests/file/bug26938.phpt21
-rw-r--r--ext/standard/tests/file/bug27508.phpt3
-rw-r--r--ext/standard/tests/file/bug35740.phpt2
-rwxr-xr-xext/standard/tests/file/bug39367.phpt33
-rw-r--r--ext/standard/tests/file/bug39538.phpt39
-rw-r--r--ext/standard/tests/file/bug39551.phpt28
-rw-r--r--ext/standard/tests/file/bug39673.phpt40
-rw-r--r--ext/standard/tests/file/bug40374.phpt17
-rw-r--r--ext/standard/tests/file/disk.phpt48
-rw-r--r--ext/standard/tests/file/fgetss.phpt83
-rw-r--r--ext/standard/tests/file/fgetss1.phpt69
-rw-r--r--ext/standard/tests/file/file_put_contents.phpt10
-rw-r--r--ext/standard/tests/file/filestat.phpt63
-rw-r--r--ext/standard/tests/file/flock.phpt64
-rw-r--r--ext/standard/tests/file/fscanf.phpt100
-rw-r--r--ext/standard/tests/file/fstat.phpt74
-rw-r--r--ext/standard/tests/file/ftruncate.phptbin0 -> 1077 bytes
-rw-r--r--ext/standard/tests/file/fwrite.phpt50
-rw-r--r--ext/standard/tests/file/get_current_user.phpt15
-rw-r--r--ext/standard/tests/file/magic_quotes.phpt61
-rw-r--r--ext/standard/tests/file/mkdir-002.phpt6
-rw-r--r--ext/standard/tests/file/mkdir-006.phpt6
-rw-r--r--ext/standard/tests/file/proc_open01.phpt2
-rw-r--r--ext/standard/tests/file/statpage.phpt20
-rw-r--r--ext/standard/tests/file/stream_001.phpt2
-rw-r--r--ext/standard/tests/file/stream_002.phpt4
-rw-r--r--ext/standard/tests/file/symlink.phpt78
-rw-r--r--ext/standard/tests/file/touch.phpt49
-rw-r--r--ext/standard/tests/general_functions/001.phpt8
-rw-r--r--ext/standard/tests/general_functions/bug27678.phpt2
-rw-r--r--ext/standard/tests/general_functions/bug34794.phpt34
-rw-r--r--ext/standard/tests/general_functions/bug39322.phpt44
-rwxr-xr-xext/standard/tests/general_functions/bug40398.phpt90
-rw-r--r--ext/standard/tests/general_functions/bug40752.phpt37
-rw-r--r--ext/standard/tests/general_functions/bug41037.phpt23
-rw-r--r--ext/standard/tests/general_functions/error_get_last.phpt43
-rw-r--r--ext/standard/tests/general_functions/getrusage.phpt23
-rw-r--r--ext/standard/tests/general_functions/head.phpt53
-rw-r--r--ext/standard/tests/general_functions/highlight_heredoc.phpt2
-rw-r--r--ext/standard/tests/general_functions/import_request.phpt78
-rw-r--r--ext/standard/tests/general_functions/include_path.phpt75
-rw-r--r--ext/standard/tests/general_functions/ini_get_all.phpt51
-rw-r--r--ext/standard/tests/general_functions/parse_ini_file.phpt175
-rw-r--r--ext/standard/tests/general_functions/phpcredits.phpt54
-rw-r--r--ext/standard/tests/general_functions/phpcredits2.phpt32
-rw-r--r--ext/standard/tests/general_functions/phpinfo.phpt75
-rw-r--r--ext/standard/tests/general_functions/phpinfo2.phpt33
-rw-r--r--ext/standard/tests/general_functions/proc_open02.phpt72
-rw-r--r--ext/standard/tests/general_functions/putenv.phpt28
-rw-r--r--ext/standard/tests/general_functions/rand.phpt63
-rw-r--r--ext/standard/tests/general_functions/sys_getloadavg.phpt32
-rw-r--r--ext/standard/tests/general_functions/type.phpt351
-rw-r--r--ext/standard/tests/math/constants.phpt2
-rw-r--r--ext/standard/tests/math/hexdec.phpt2
-rw-r--r--ext/standard/tests/network/inet.phpt75
-rw-r--r--ext/standard/tests/network/inet_ipv6.phpt50
-rw-r--r--ext/standard/tests/network/ip.phpt67
-rwxr-xr-xext/standard/tests/network/shutdown.phpt65
-rw-r--r--ext/standard/tests/serialize/003.phpt4
-rw-r--r--ext/standard/tests/serialize/bug24063.phpt10
-rwxr-xr-xext/standard/tests/serialize/bug31442.phpt2
-rwxr-xr-xext/standard/tests/serialize/unserializeS.phpt14
-rw-r--r--ext/standard/tests/strings/bug22207.phpt4
-rw-r--r--ext/standard/tests/strings/bug26819.phpt2
-rw-r--r--ext/standard/tests/strings/bug36392.phpt16
-rw-r--r--ext/standard/tests/strings/bug38770.phpt25
-rw-r--r--ext/standard/tests/strings/bug39350.phpt13
-rw-r--r--ext/standard/tests/strings/bug39621.phptbin0 -> 866 bytes
-rw-r--r--ext/standard/tests/strings/bug39873.phpt17
-rw-r--r--ext/standard/tests/strings/bug40432.phpt8
-rw-r--r--ext/standard/tests/strings/bug40637.phpt13
-rw-r--r--ext/standard/tests/strings/bug40704.phpt13
-rw-r--r--ext/standard/tests/strings/bug40754.phpt63
-rw-r--r--ext/standard/tests/strings/bug40915.phptbin0 -> 347 bytes
-rw-r--r--ext/standard/tests/strings/convert_cyr_string.phpt54
-rw-r--r--ext/standard/tests/strings/crypt.phpt13
-rw-r--r--ext/standard/tests/strings/get_meta_tags.phpt95
-rw-r--r--ext/standard/tests/strings/highlight_file.phpt68
-rw-r--r--ext/standard/tests/strings/htmlentities02.phpt6
-rw-r--r--ext/standard/tests/strings/levenshtein.phpt88
-rw-r--r--ext/standard/tests/strings/ltrim.phpt83
-rw-r--r--ext/standard/tests/strings/metaphone.phpt41
-rw-r--r--ext/standard/tests/strings/pack.phpt385
-rw-r--r--ext/standard/tests/strings/pathinfo.phpt14
-rw-r--r--ext/standard/tests/strings/php_strip_whitespace.phpt52
-rwxr-xr-xext/standard/tests/strings/printf.phpt697
-rwxr-xr-xext/standard/tests/strings/printf_64bit.phpt695
-rw-r--r--ext/standard/tests/strings/rtrim.phptbin0 -> 2422 bytes
-rw-r--r--ext/standard/tests/strings/sha1.phpt55
-rw-r--r--ext/standard/tests/strings/soundex.phpt55
-rwxr-xr-xext/standard/tests/strings/sprintf_f.phpt2
-rwxr-xr-xext/standard/tests/strings/sprintf_f_2.phpt114
-rwxr-xr-xext/standard/tests/strings/sprintf_f_3.phpt23
-rw-r--r--ext/standard/tests/strings/str_ireplace.phpt101
-rw-r--r--ext/standard/tests/strings/str_pad.phptbin0 -> 9070 bytes
-rw-r--r--ext/standard/tests/strings/strcasecmp.phptbin0 -> 22190 bytes
-rw-r--r--ext/standard/tests/strings/strcmp.phptbin0 -> 19960 bytes
-rw-r--r--ext/standard/tests/strings/stristr.phpt43
-rw-r--r--ext/standard/tests/strings/strlen.phptbin0 -> 7030 bytes
-rw-r--r--ext/standard/tests/strings/substr_compare.phpt2
-rw-r--r--ext/standard/tests/strings/ucfirst.phptbin0 -> 6055 bytes
-rw-r--r--ext/standard/tests/strings/uuencode.phpt40
-rwxr-xr-xext/standard/tests/time/bug38524.phpt2
128 files changed, 6400 insertions, 79 deletions
diff --git a/ext/standard/tests/array/array_diff_key.phpt b/ext/standard/tests/array/array_diff_key.phpt
index 91664a871..765431f12 100644
--- a/ext/standard/tests/array/array_diff_key.phpt
+++ b/ext/standard/tests/array/array_diff_key.phpt
@@ -66,13 +66,13 @@ function comp_func($a, $b) {
------ Test 1 --------
array(4) {
[1]=>
- &int(2)
+ int(2)
[6]=>
- &int(12)
+ int(12)
[15]=>
- &int(30)
+ int(30)
[1200]=>
- &int(2400)
+ int(2400)
}
array(4) {
[1]=>
@@ -188,11 +188,11 @@ array(3) {
------ Test 7 --------
array(3) {
[7]=>
- &int(14)
+ int(14)
[11]=>
- &int(22)
+ int(22)
[1100]=>
- &int(2200)
+ int(2200)
}
array(3) {
[7]=>
diff --git a/ext/standard/tests/array/array_flip.phpt b/ext/standard/tests/array/array_flip.phpt
index 27b14fdd9..af26fd80c 100644
--- a/ext/standard/tests/array/array_flip.phpt
+++ b/ext/standard/tests/array/array_flip.phpt
@@ -14,6 +14,13 @@ $trans = array("a" => 1,
2 => "i");
$trans = array_flip($trans);
var_dump($trans);
+
+var_dump(array_flip());
+var_dump(array_flip(array()));
+var_dump(array_flip(array(1)));
+var_dump(array_flip(array(array())));
+
+echo "Done\n";
?>
--EXPECTF--
Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
@@ -35,3 +42,17 @@ array(6) {
["i"]=>
int(2)
}
+
+Warning: Wrong parameter count for array_flip() in %s on line %d
+NULL
+array(0) {
+}
+array(1) {
+ [1]=>
+ int(0)
+}
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_key.phpt b/ext/standard/tests/array/array_intersect_key.phpt
index 6a5965ba7..6d2783940 100644
--- a/ext/standard/tests/array/array_intersect_key.phpt
+++ b/ext/standard/tests/array/array_intersect_key.phpt
@@ -62,9 +62,9 @@ function comp_func($a, $b) {
--EXPECTF--
array(3) {
[2]=>
- &int(4)
+ int(4)
[-20]=>
- &int(-40)
+ int(-40)
[-2500]=>
&int(-5000)
}
@@ -138,11 +138,11 @@ array(1) {
}
array(4) {
[0]=>
- &int(0)
+ int(0)
[2]=>
- &int(4)
+ int(4)
[-20]=>
- &int(-40)
+ int(-40)
[-2500]=>
&int(-5000)
}
diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt
new file mode 100644
index 000000000..e7b6c0677
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists.phpt
@@ -0,0 +1,40 @@
+--TEST--
+array_key_exists() tests
+--FILE--
+<?php
+
+var_dump(array_key_exists());
+var_dump(array_key_exists(array(), array()));
+var_dump(array_key_exists("", ""));
+var_dump(array_key_exists("", array()));
+var_dump(array_key_exists(1, array()));
+
+var_dump(array_key_exists(1, array(1,2,3)));
+var_dump(array_key_exists("a", array(3,2,1,"a"=>1)));
+var_dump(array_key_exists("a", array(3,2,1)));
+var_dump(array_key_exists(NULL, array(5,6,7,""=>"value", 3,2,1)));
+var_dump(array_key_exists(NULL, array(5,6,7,3,2,1)));
+var_dump(array_key_exists(false, array(5,6,7,""=>"value", 3,2,1)));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for array_key_exists() in %s on line %d
+NULL
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt
new file mode 100644
index 000000000..e6c4590c1
--- /dev/null
+++ b/ext/standard/tests/array/array_pad.phpt
@@ -0,0 +1,101 @@
+--TEST--
+array_pad() tests
+--FILE--
+<?php
+
+var_dump(array_pad());
+var_dump(array_pad(array()));
+var_dump(array_pad(array(), 1));
+var_dump(array_pad(array(), 1, 0));
+
+var_dump(array_pad(array(), 0, 0));
+var_dump(array_pad(array(), -1, 0));
+var_dump(array_pad(array("", -1, 2.0), 5, 0));
+var_dump(array_pad(array("", -1, 2.0), 5, array()));
+var_dump(array_pad(array("", -1, 2.0), 2, array()));
+var_dump(array_pad(array("", -1, 2.0), -3, array()));
+var_dump(array_pad(array("", -1, 2.0), -4, array()));
+var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
+var_dump(array_pad("", 2000000, 0));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for array_pad() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_pad() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_pad() in %s on line %d
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(5) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ int(-1)
+ [2]=>
+ float(2)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+}
+array(5) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ int(-1)
+ [2]=>
+ float(2)
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ array(0) {
+ }
+}
+array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ int(-1)
+ [2]=>
+ float(2)
+}
+array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ int(-1)
+ [2]=>
+ float(2)
+}
+array(4) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ string(0) ""
+ [2]=>
+ int(-1)
+ [3]=>
+ float(2)
+}
+
+Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d
+bool(false)
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt
new file mode 100644
index 000000000..22424465a
--- /dev/null
+++ b/ext/standard/tests/array/array_rand.phpt
@@ -0,0 +1,51 @@
+--TEST--
+array_rand() tests
+--FILE--
+<?php
+
+var_dump(array_rand());
+var_dump(array_rand(array()));
+var_dump(array_rand(array(), 0));
+var_dump(array_rand(0, 0));
+var_dump(array_rand(array(1,2,3), 0));
+var_dump(array_rand(array(1,2,3), -1));
+var_dump(array_rand(array(1,2,3), 10));
+var_dump(array_rand(array(1,2,3), 3));
+var_dump(array_rand(array(1,2,3), 2));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for array_rand() in %s on line %d
+NULL
+NULL
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+array(2) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+}
+Done
diff --git a/ext/standard/tests/array/array_sum.phpt b/ext/standard/tests/array/array_sum.phpt
index f1868cb2e..08aec2155 100644
--- a/ext/standard/tests/array/array_sum.phpt
+++ b/ext/standard/tests/array/array_sum.phpt
@@ -1,7 +1,8 @@
--TEST--
Test array_sum()
--INI--
-memory_limit=64M
+precision=14
+memory_limit=128M
--FILE--
<?php
$i = 0;
diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt
new file mode 100644
index 000000000..0e8dae919
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift.phpt
@@ -0,0 +1,40 @@
+--TEST--
+array_unshift() tests
+--FILE--
+<?php
+
+$a = array();
+$s = "";
+var_dump(array_unshift($a, $s));
+var_dump($a);
+var_dump(array_unshift($s, $a));
+var_dump($a);
+var_dump(array_unshift($a, $a));
+var_dump($a);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(1)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+int(2)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [1]=>
+ string(0) ""
+}
+Done
diff --git a/ext/standard/tests/array/array_user_key_compare.phpt b/ext/standard/tests/array/array_user_key_compare.phpt
new file mode 100644
index 000000000..7f82f71ca
--- /dev/null
+++ b/ext/standard/tests/array/array_user_key_compare.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Fix UMR in array_user_key_compare (MOPB24)
+--FILE--
+<?php
+$arr = array("A" => 1, "B" => 1);
+
+function array_compare(&$key1, &$key2)
+ {
+ $GLOBALS['a'] = &$key2;
+ unset($key2);
+ return 1;
+ }
+
+uksort($arr, "array_compare");
+var_dump($a);
+
+?>
+--EXPECTF--
+string(1) "A"
diff --git a/ext/standard/tests/array/array_values.phpt b/ext/standard/tests/array/array_values.phpt
new file mode 100644
index 000000000..42e252ac8
--- /dev/null
+++ b/ext/standard/tests/array/array_values.phpt
@@ -0,0 +1,47 @@
+--TEST--
+array_values() tests
+--FILE--
+<?php
+
+var_dump(array_values());
+var_dump(array_values(array()));
+var_dump(array_values(""));
+var_dump(array_values(new stdclass));
+
+$a = array(1, 2, 2.0, "asdasd", array(1,2,3));
+
+var_dump(array_values($a));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for array_values() in %s on line %d
+NULL
+array(0) {
+}
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(2)
+ [3]=>
+ string(6) "asdasd"
+ [4]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/bug30074.phpt b/ext/standard/tests/array/bug30074.phpt
new file mode 100644
index 000000000..7720fe000
--- /dev/null
+++ b/ext/standard/tests/array/bug30074.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #30074 (EG(uninitialized_zval_ptr) gets set to reference using EXTR_REFS, affecting later values)
+--FILE--
+<?php
+error_reporting(E_ALL & ~E_NOTICE); // We don't want the notice for $undefined
+$result = extract(array('a'=>$undefined), EXTR_REFS);
+var_dump(array($a));
+echo "Done\n";
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ NULL
+}
+Done
diff --git a/ext/standard/tests/array/bug33382.phpt b/ext/standard/tests/array/bug33382.phpt
index 407b5846f..376227f1f 100644
--- a/ext/standard/tests/array/bug33382.phpt
+++ b/ext/standard/tests/array/bug33382.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #33382 ( array_reverse() fails after *sort() )
+Bug #33382 ( array_reverse() fails after *sort() )
--FILE--
<?php
diff --git a/ext/standard/tests/array/bug36975.phpt b/ext/standard/tests/array/bug36975.phpt
new file mode 100644
index 000000000..f37c933e3
--- /dev/null
+++ b/ext/standard/tests/array/bug36975.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Bug #36975 (natcasesort() causes array_pop() to misbehave)
+--FILE--
+<?php
+$a = array('aa', 'aa', 'bb', 'bb', 'cc', 'cc');
+$test = natcasesort($a);
+if ($test) {
+ echo "natcasesort success!\n";
+}
+$val = array_pop($a);
+$a[] = $val;
+var_dump($a);
+
+$b = array(1 => 'foo', 0 => 'baz');
+array_pop($b);
+$b[] = 'bar';
+array_push($b, 'bar');
+print_r($b);
+
+$c = array(0, 0, 0, 0, 0);
+asort($c);
+array_pop($c);
+$c[] = 'foo';
+$c[] = 'bar';
+var_dump($c);
+?>
+--EXPECT--
+natcasesort success!
+array(6) {
+ [0]=>
+ string(2) "aa"
+ [1]=>
+ string(2) "aa"
+ [3]=>
+ string(2) "bb"
+ [2]=>
+ string(2) "bb"
+ [5]=>
+ string(2) "cc"
+ [6]=>
+ string(2) "cc"
+}
+Array
+(
+ [1] => foo
+ [2] => bar
+ [3] => bar
+)
+array(6) {
+ [4]=>
+ int(0)
+ [3]=>
+ int(0)
+ [2]=>
+ int(0)
+ [1]=>
+ int(0)
+ [5]=>
+ string(3) "foo"
+ [6]=>
+ string(3) "bar"
+}
diff --git a/ext/standard/tests/array/bug39576.phpt b/ext/standard/tests/array/bug39576.phpt
new file mode 100644
index 000000000..7c8aeef17
--- /dev/null
+++ b/ext/standard/tests/array/bug39576.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Bug #39576 (array_walk() doesn't separate userdata zval)
+--FILE--
+<?php
+
+class Test {
+
+ public $_table = '';
+ public $_columns = array ();
+ public $_primary = array ();
+
+}
+
+$test = new Test ();
+$test->name = 'test';
+$test->_columns['name'] = new stdClass;
+
+function test ($value, $column, &$columns) {}
+
+array_walk (
+ get_object_vars ($test),
+ 'test',
+ $test->_columns
+);
+
+var_dump($test);
+
+array_intersect_key (
+ get_object_vars ($test),
+ $test->_primary
+);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Strict Standards: Only variables should be passed by reference in %s on line %d
+object(Test)#%d (4) {
+ ["_table"]=>
+ string(0) ""
+ ["_columns"]=>
+ array(1) {
+ ["name"]=>
+ object(stdClass)#%d (0) {
+ }
+ }
+ ["_primary"]=>
+ array(0) {
+ }
+ ["name"]=>
+ string(4) "test"
+}
+Done
diff --git a/ext/standard/tests/array/bug40191.phpt b/ext/standard/tests/array/bug40191.phpt
new file mode 100644
index 000000000..038104b57
--- /dev/null
+++ b/ext/standard/tests/array/bug40191.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #40191 (use of array_unique() with objects triggers segfault)
+--SKIPIF--
+<?php if (!extension_loaded('spl')) die("skip SPL is not available"); ?>
+--FILE--
+<?php
+
+$arrObj = new ArrayObject();
+$arrObj->append('foo');
+$arrObj->append('bar');
+$arrObj->append('foo');
+
+$arr = array_unique($arrObj);
+var_dump($arr);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+}
+Done
diff --git a/ext/standard/tests/array/bug40709.phpt b/ext/standard/tests/array/bug40709.phpt
new file mode 100644
index 000000000..6ab6bbd41
--- /dev/null
+++ b/ext/standard/tests/array/bug40709.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #40709 (array_reduce() behaves strange with one item stored arrays)
+--SKIPIF--
+--FILE--
+<?php
+function CommaSeperatedList($a, $b) {
+ if($a == null)
+ return $b;
+ else
+ return $a.','.$b;
+}
+
+$arr1 = array(1,2,3);
+$arr2 = array(1);
+
+echo "result for arr1: ".array_reduce($arr1,'CommaSeperatedList')."\n";
+echo "result for arr2: ".array_reduce($arr2,'CommaSeperatedList')."\n";
+echo "result for arr1: ".array_reduce($arr1,'CommaSeperatedList')."\n";
+echo "result for arr2: ".array_reduce($arr2,'CommaSeperatedList')."\n";
+
+echo "Done\n";
+?>
+--EXPECT--
+result for arr1: 1,2,3
+result for arr2: 1
+result for arr1: 1,2,3
+result for arr2: 1
+Done
diff --git a/ext/standard/tests/array/bug41121.phpt b/ext/standard/tests/array/bug41121.phpt
new file mode 100644
index 000000000..a03bdaf4c
--- /dev/null
+++ b/ext/standard/tests/array/bug41121.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Bug #41121 (range() overflow handling for large numbers on 32bit machines)
+--INI--
+precision=14
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
+--FILE--
+<?php
+
+// posotive steps
+var_dump(range(2147483400, 2147483600, 100));
+var_dump( range(2147483646, 2147483648, 1 ) );
+var_dump( range(2147483646, 2147483657, 1 ) );
+var_dump( range(2147483630, 2147483646, 5 ) );
+
+// negative steps
+var_dump( range(-2147483645, -2147483648, 1 ) );
+var_dump( range(-2147483645, -2147483649, 1 ) );
+var_dump( range(-2147483630, -2147483646, 5 ) );
+
+// low > high
+var_dump(range(2147483647, 2147483645, 1 ));
+var_dump(range(2147483648, 2147483645, 1 ));
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ int(2147483400)
+ [1]=>
+ int(2147483500)
+ [2]=>
+ int(2147483600)
+}
+array(3) {
+ [0]=>
+ float(2147483646)
+ [1]=>
+ float(2147483647)
+ [2]=>
+ float(2147483648)
+}
+array(12) {
+ [0]=>
+ float(2147483646)
+ [1]=>
+ float(2147483647)
+ [2]=>
+ float(2147483648)
+ [3]=>
+ float(2147483649)
+ [4]=>
+ float(2147483650)
+ [5]=>
+ float(2147483651)
+ [6]=>
+ float(2147483652)
+ [7]=>
+ float(2147483653)
+ [8]=>
+ float(2147483654)
+ [9]=>
+ float(2147483655)
+ [10]=>
+ float(2147483656)
+ [11]=>
+ float(2147483657)
+}
+array(4) {
+ [0]=>
+ int(2147483630)
+ [1]=>
+ int(2147483635)
+ [2]=>
+ int(2147483640)
+ [3]=>
+ int(2147483645)
+}
+array(4) {
+ [0]=>
+ float(-2147483645)
+ [1]=>
+ float(-2147483646)
+ [2]=>
+ float(-2147483647)
+ [3]=>
+ float(-2147483648)
+}
+array(5) {
+ [0]=>
+ float(-2147483645)
+ [1]=>
+ float(-2147483646)
+ [2]=>
+ float(-2147483647)
+ [3]=>
+ float(-2147483648)
+ [4]=>
+ float(-2147483649)
+}
+array(4) {
+ [0]=>
+ int(-2147483630)
+ [1]=>
+ int(-2147483635)
+ [2]=>
+ int(-2147483640)
+ [3]=>
+ int(-2147483645)
+}
+array(3) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ int(2147483646)
+ [2]=>
+ int(2147483645)
+}
+array(4) {
+ [0]=>
+ float(2147483648)
+ [1]=>
+ float(2147483647)
+ [2]=>
+ float(2147483646)
+ [3]=>
+ float(2147483645)
+}
diff --git a/ext/standard/tests/array/compact.phpt b/ext/standard/tests/array/compact.phpt
new file mode 100644
index 000000000..b70e55846
--- /dev/null
+++ b/ext/standard/tests/array/compact.phpt
@@ -0,0 +1,60 @@
+--TEST--
+compact() tests
+--FILE--
+<?php
+
+$var1 = "test";
+$var2 = "one more";
+$var3 = "and the last one";
+$_ = "a";
+
+var_dump(compact("var1", "var2", "var3"));
+var_dump(compact(""));
+var_dump(compact("-1"));
+var_dump(compact("."));
+var_dump(compact("_"));
+var_dump(compact("var3", "var4"));
+var_dump(compact(array("var2", "var3")));
+var_dump(compact(array(array("var1"), array("var1"))));
+
+$a = array(2.0, -5);
+var_dump(compact($a));
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(3) {
+ ["var1"]=>
+ string(4) "test"
+ ["var2"]=>
+ string(8) "one more"
+ ["var3"]=>
+ string(16) "and the last one"
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ ["_"]=>
+ string(1) "a"
+}
+array(1) {
+ ["var3"]=>
+ string(16) "and the last one"
+}
+array(2) {
+ ["var2"]=>
+ string(8) "one more"
+ ["var3"]=>
+ string(16) "and the last one"
+}
+array(1) {
+ ["var1"]=>
+ string(4) "test"
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/locale_sort.phpt b/ext/standard/tests/array/locale_sort.phpt
index b4e15fa52..4b7068fa8 100644
--- a/ext/standard/tests/array/locale_sort.phpt
+++ b/ext/standard/tests/array/locale_sort.phpt
@@ -2,13 +2,13 @@
Sort with SORT_LOCALE_STRING
--SKIPIF--
<?php
-if ("fr_FR" != setlocale(LC_CTYPE, "fr_FR")) {
+if (false == setlocale(LC_CTYPE, "fr_FR", "fr_FR.ISO8859-1")) {
die("skip setlocale() failed\n");
}
?>
--FILE--
<?php
-setlocale(LC_ALL, 'fr_FR');
+setlocale(LC_ALL, 'fr_FR', 'fr_FR.ISO8859-1');
$table = array("AB" => "Alberta",
"BC" => "Colombie-Britannique",
"MB" => "Manitoba",
diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt
index 88a1e1242..ac0824cda 100644
--- a/ext/standard/tests/assert/assert02.phpt
+++ b/ext/standard/tests/assert/assert02.phpt
@@ -31,12 +31,12 @@ Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d
Parse error: %s error%sassert02.php(%d) : assert code on line 1
in handler()
-string(64) "assert(): Failure evaluating code:
+string(%d) "assert(): Failure evaluating code:
aa=sd+as+safsafasfaçsafçsafç"
Warning: assert(): Assertion "0" failed in %sassert02.php on line %d
Parse error: %s error%sassert02.php(%d) : assert code on line 1
in handler()
-string(64) "assert(): Failure evaluating code:
+string(%d) "assert(): Failure evaluating code:
aa=sd+as+safsafasfaçsafçsafç"
diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt
new file mode 100644
index 000000000..077474d4d
--- /dev/null
+++ b/ext/standard/tests/assert/assert03.phpt
@@ -0,0 +1,33 @@
+--TEST--
+assert() - set callback using ini_set()
+--FILE--
+<?php
+function a($file,$line,$myev)
+{
+ echo "assertion failed - a - $line,\"$myev\"\n";
+}
+
+function b($file,$line,$myev)
+{
+ echo "assertion failed - b - $line,\"$myev\"\n";
+}
+
+assert_options(ASSERT_ACTIVE,1);
+assert_options(ASSERT_QUIET_EVAL,1);
+assert_options(ASSERT_WARNING,0);
+
+$a = 0;
+
+assert_options(ASSERT_CALLBACK,"a");
+assert('$a != 0');
+
+ /* Modify call back using ini_set() */
+ini_set("assert.callback", "b");
+assert('$a != 0');
+
+?>
+==DONE==
+--EXPECTF--
+assertion failed - a - %d,"$a != 0"
+assertion failed - b - %d,"$a != 0"
+==DONE==
diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt
new file mode 100644
index 000000000..43028ad3a
--- /dev/null
+++ b/ext/standard/tests/assert/assert04.phpt
@@ -0,0 +1,41 @@
+--TEST--
+misc assert() tests tests
+--FILE--
+<?php
+/* Assert not active */
+assert_options(ASSERT_ACTIVE, 0);
+assert(1);
+
+
+/* Wrong parameter count in assert */
+assert_options(ASSERT_ACTIVE, 1);
+assert(2,3);
+
+/* Wrong parameter count in assert_options */
+assert_options(ASSERT_ACTIVE, 0, 2);
+
+/* Wrong parameter name in assert_options */
+$test="ASSERT_FRED";
+assert_options($test, 1);
+
+/* Assert false */
+assert(0);
+
+
+/* Assert false and bail*/
+assert_options(ASSERT_BAIL, 1);
+assert(0);
+
+echo "not reached\n";
+
+?>
+--EXPECTF--
+Warning: Wrong parameter count for assert() in %s on line %d
+
+Warning: Wrong parameter count for assert_options() in %s on line %d
+
+Warning: assert_options(): Unknown value 0 in %s on line %d
+
+Warning: assert(): Assertion failed in %s on line %d
+
+Warning: assert(): Assertion failed in %s on line %d
diff --git a/ext/standard/tests/file/bug22414.phpt b/ext/standard/tests/file/bug22414.phpt
index 0775fc8a7..b60b865e7 100644
--- a/ext/standard/tests/file/bug22414.phpt
+++ b/ext/standard/tests/file/bug22414.phpt
@@ -16,8 +16,13 @@ output_handler=
/* Binary Data Test */
- $cmd = $php . ' -n -r \"readfile(@getenv(\'TEST_PHP_EXECUTABLE\')); \"';
- $cmd = $php . ' -n -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ;
+ if (substr(PHP_OS, 0, 3) != 'WIN') {
+ $cmd = $php . ' -n -r \"readfile(@getenv(\'TEST_PHP_EXECUTABLE\')); \"';
+ $cmd = $php . ' -n -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ;
+ } else {
+ $cmd = $php . ' -n -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"';
+ $cmd = $php . ' -n -r " passthru(\''.$cmd.'\');" > '.$tmpfile ;
+ }
exec($cmd);
if (md5_file($php) == md5_file($tmpfile)) {
diff --git a/ext/standard/tests/file/bug24313.phpt b/ext/standard/tests/file/bug24313.phpt
index 04057c58a..e5bceee85 100644
--- a/ext/standard/tests/file/bug24313.phpt
+++ b/ext/standard/tests/file/bug24313.phpt
@@ -1,5 +1,11 @@
--TEST--
Bug #24313 (file_exists() throws a warning on nonexistent files when is open_basedir enabled)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip "/dev" is not available');
+}
+?>
--INI--
open_basedir=/dev
--FILE--
diff --git a/ext/standard/tests/file/bug26615.phpt b/ext/standard/tests/file/bug26615.phpt
index 34d71e4b3..4de8b4a46 100644
--- a/ext/standard/tests/file/bug26615.phpt
+++ b/ext/standard/tests/file/bug26615.phpt
@@ -6,7 +6,11 @@ variables_order=E
<?php
$out = array();
$status = -1;
-exec($_ENV['TEST_PHP_EXECUTABLE'].' -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status);
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ exec($_ENV['TEST_PHP_EXECUTABLE'].' -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status);
+} else {
+ exec($_ENV['TEST_PHP_EXECUTABLE'].' -r "for($i=1;$i<=5000;$i++) echo $i,\' \';"', $out, $status);
+}
print_r($out);
?>
--EXPECT--
diff --git a/ext/standard/tests/file/bug26938.phpt b/ext/standard/tests/file/bug26938.phpt
index 8e059ee84..c43e6b103 100644
--- a/ext/standard/tests/file/bug26938.phpt
+++ b/ext/standard/tests/file/bug26938.phpt
@@ -5,12 +5,21 @@ Bug #26938 (exec does not read consecutive long lines correctly)
$out = array();
$status = -1;
$php = getenv('TEST_PHP_EXECUTABLE');
-exec($php . ' -r \''
- . '$lengths = array(10,20000,10000,5,10000,3);'
- . 'foreach($lengths as $length) {'
- . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
- . ' print "\n";'
- . '}\'', $out, $status);
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ exec($php . ' -r \''
+ . '$lengths = array(10,20000,10000,5,10000,3);'
+ . 'foreach($lengths as $length) {'
+ . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
+ . ' print "\n";'
+ . '}\'', $out, $status);
+} else {
+ exec($php . ' -r "'
+ . '$lengths = array(10,20000,10000,5,10000,3);'
+ . 'foreach($lengths as $length) {'
+ . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
+ . ' print \\"\\n\\";'
+ . '}"', $out, $status);
+}
for ($i=0;$i<6;$i++)
print "md5(line $i)= " . md5($out[$i]) . " (length " .
strlen($out[$i]) . ")\n";
diff --git a/ext/standard/tests/file/bug27508.phpt b/ext/standard/tests/file/bug27508.phpt
index 5374a0dcb..cc46a3e3e 100644
--- a/ext/standard/tests/file/bug27508.phpt
+++ b/ext/standard/tests/file/bug27508.phpt
@@ -54,12 +54,13 @@ debug_zval_dump(feof($fp));
rewind($fp);
echo ftell($fp) . "\n";
debug_zval_dump(feof($fp));
-while (!feof($fp)) {
+while ($fp && !feof($fp)) {
echo fgets($fp);
}
fclose($fp);
unlink($tn);
+?>
--EXPECT--
bool(false) refcount(1)
0
diff --git a/ext/standard/tests/file/bug35740.phpt b/ext/standard/tests/file/bug35740.phpt
index 78df1843c..3526b2497 100644
--- a/ext/standard/tests/file/bug35740.phpt
+++ b/ext/standard/tests/file/bug35740.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #35740 (memory leak when including a directory)
+Bug #35740 (memory leak when including a directory)
--FILE--
<?php
diff --git a/ext/standard/tests/file/bug39367.phpt b/ext/standard/tests/file/bug39367.phpt
new file mode 100755
index 000000000..01fb5e8c8
--- /dev/null
+++ b/ext/standard/tests/file/bug39367.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #39367 (clearstatcache() doesn't clear realpath cache)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+function test() {
+ unlink('/tmp/1link');
+ unlink('/tmp/1tmp');
+ unlink('/tmp/testfile1');
+
+ file_put_contents('/tmp/testfile1', 'ok');
+ symlink('/tmp/testfile1', '/tmp/1tmp');
+ rename('/tmp/1tmp', '/tmp/1link');
+ echo file_get_contents('/tmp/1link')."\n";
+
+ unlink('/tmp/1link');
+ clearstatcache();
+
+ echo file_get_contents('/tmp/1link')."\n";
+
+ unlink('/tmp/1link');
+ unlink('/tmp/1tmp');
+ unlink('/tmp/testfile1');
+}
+@test();
+?>
+--EXPECT--
+ok
diff --git a/ext/standard/tests/file/bug39538.phpt b/ext/standard/tests/file/bug39538.phpt
new file mode 100644
index 000000000..1724a7247
--- /dev/null
+++ b/ext/standard/tests/file/bug39538.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Bug #39538 (fgetcsv can't handle starting newlines and trailing odd number of backslashes)
+--FILE--
+<?php
+$content = array("\"\nthis is an test\", \"next data\", \"p\narsed\"","\"\r\nthis is an test\", \"next data\", \"p\r\narsed\"","\"\n\rthis is an test\", \"next data\", \"p\n\rarsed\"");
+
+$file = dirname(__FILE__) . "/bug39538.csv";
+@unlink($file);
+foreach ($content as $v) {
+ file_put_contents($file, $v);
+ print_r (fgetcsv(fopen($file, "r"), filesize($file)));
+}
+@unlink($file);
+?>
+--EXPECT--
+Array
+(
+ [0] =>
+this is an test
+ [1] => next data
+ [2] => p
+arsed
+)
+Array
+(
+ [0] =>
+this is an test
+ [1] => next data
+ [2] => p
+arsed
+)
+Array
+(
+ [0] =>
+ this is an test
+ [1] => next data
+ [2] => p
+ arsed
+)
diff --git a/ext/standard/tests/file/bug39551.phpt b/ext/standard/tests/file/bug39551.phpt
new file mode 100644
index 000000000..67dc7e7b2
--- /dev/null
+++ b/ext/standard/tests/file/bug39551.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #39551 (Segfault with stream_bucket_new in user filter)
+--FILE--
+<?php
+
+$bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');
+
+class bucketFilter {
+ public function filter($in, $out, &$consumed, $closing ){
+
+ $bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');
+ stream_bucket_append($out, $bucket);
+ return PSFS_PASS_ON;
+ }
+}
+
+stream_filter_register('bucketfault', 'bucketFilter');
+stream_filter_append($s = fopen('php://temp', 'r+'), 'bucketfault');
+stream_get_contents($s);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Done
+--UEXPECTF--
+Done
+
+Notice: Unknown: 0 character unicode buffer downcoded for binary stream runtime_encoding in Unknown on line 0
diff --git a/ext/standard/tests/file/bug39673.phpt b/ext/standard/tests/file/bug39673.phpt
new file mode 100644
index 000000000..3836f2103
--- /dev/null
+++ b/ext/standard/tests/file/bug39673.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #39673 (file_get_contents causes bus error on certain offsets)
+--FILE--
+<?php
+
+$str = str_repeat("test", 3456);
+
+$filename = dirname(__FILE__).'/bug39673.txt';
+file_put_contents($filename, $str);
+
+$offsets = array(
+ -1,
+ 0,
+ 3456*4,
+ 3456*4 - 1,
+ 3456*4 + 1,
+ 2000,
+ 5000,
+ 100000,
+);
+
+
+foreach ($offsets as $offset) {
+ $r = file_get_contents($filename, false, null, $offset);
+ var_dump(strlen($r));
+}
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+int(13824)
+int(13824)
+int(0)
+int(1)
+int(0)
+int(11824)
+int(8824)
+int(0)
+Done
diff --git a/ext/standard/tests/file/bug40374.phpt b/ext/standard/tests/file/bug40374.phpt
new file mode 100644
index 000000000..2be48008d
--- /dev/null
+++ b/ext/standard/tests/file/bug40374.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #40374 (php_shutdown_temporary_directory() tries to free local value)
+--FILE--
+<?php
+
+$file = tempnam(sys_get_temp_dir(), "test_");
+var_dump($file);
+$fp = fopen($file, "w");
+fwrite($fp, "test");
+fclose($fp);
+unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(%d) "%s"
+Done
diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt
new file mode 100644
index 000000000..6eef4b4a7
--- /dev/null
+++ b/ext/standard/tests/file/disk.phpt
@@ -0,0 +1,48 @@
+--TEST--
+disk_total_space() and disk_free_space() tests
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for Windows');
+}
+?>
+--FILE--
+<?php
+
+var_dump(disk_free_space());
+var_dump(disk_total_space());
+
+var_dump(disk_free_space(-1));
+var_dump(disk_total_space(-1));
+
+var_dump(disk_free_space("/"));
+var_dump(disk_total_space("/"));
+
+var_dump(disk_free_space("/some/path/here"));
+var_dump(disk_total_space("/some/path/here"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: disk_free_space(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: disk_total_space(): No such file or directory in %s on line %d
+bool(false)
+float(%d)
+float(%d)
+
+Warning: disk_free_space(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: disk_total_space(): No such file or directory in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt
new file mode 100644
index 000000000..b4ac21167
--- /dev/null
+++ b/ext/standard/tests/file/fgetss.phpt
@@ -0,0 +1,83 @@
+--TEST--
+fgetss() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/fgetss.html";
+
+$array = array(
+ "askasdfasdf<b>aaaaaa\n</b>dddddd",
+ "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
+ "aaa<script>function foo() {}</script>qqq",
+ "asdasd<a\n asdjeje",
+ "",
+ "some text \n<b>blah</i>",
+ "some another text <> hoho </>"
+ );
+
+foreach ($array as $str) {
+ file_put_contents($filename, $str);
+ $fp = fopen($filename, "r");
+ var_dump(fgetss($fp));
+ var_dump(fgetss($fp));
+}
+
+foreach ($array as $str) {
+ file_put_contents($filename, $str);
+ $fp = fopen($filename, "r");
+ var_dump(fgetss($fp, 10));
+ var_dump(fgetss($fp, 10));
+}
+
+var_dump(fgetss($fp, -10));
+var_dump(fgetss($fp, 0));
+fclose($fp);
+var_dump(fgetss($fp, 0));
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(18) "askasdfasdfaaaaaa
+"
+string(6) "dddddd"
+string(6) "asdqw
+"
+string(8) "aaaaqqqq"
+string(23) "aaafunction foo() {}qqq"
+bool(false)
+string(6) "asdasd"
+string(0) ""
+bool(false)
+bool(false)
+string(11) "some text
+"
+string(4) "blah"
+string(24) "some another text hoho "
+bool(false)
+string(9) "askasdfas"
+string(6) "dfaaaa"
+string(5) "asdqw"
+string(0) ""
+string(3) "aaa"
+string(7) "functio"
+string(6) "asdasd"
+string(0) ""
+bool(false)
+bool(false)
+string(9) "some text"
+string(2) "
+"
+string(9) "some anot"
+string(9) "her text "
+
+Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
+bool(false)
+
+Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
+bool(false)
+
+Warning: fgetss(): %d is not a valid stream resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt
new file mode 100644
index 000000000..96b8b6f53
--- /dev/null
+++ b/ext/standard/tests/file/fgetss1.phpt
@@ -0,0 +1,69 @@
+--TEST--
+more fgetss() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/fgetss1.html";
+
+$array = array(
+ "askasdfasdf<b>aaaaaa\n</b>dddddd",
+ "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
+ "aaa<script>function foo() {}</script>qqq",
+ "asdasd<a\n asdjeje",
+ "",
+ "some text \n<b>blah</i>",
+ "some another text <> hoho </>"
+ );
+
+foreach ($array as $str) {
+ file_put_contents($filename, $str);
+ $fp = fopen($filename, "r");
+ var_dump(fgetss($fp, 1000, "<i>,<b>,<a>"));
+ var_dump(fgetss($fp));
+}
+
+foreach ($array as $str) {
+ file_put_contents($filename, $str);
+ $fp = fopen($filename, "r");
+ var_dump(fgetss($fp, 10));
+ var_dump(fgetss($fp, 10, "<script>,<a>"));
+}
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(21) "askasdfasdf<b>aaaaaa
+"
+string(6) "dddddd"
+string(28) "asdqw<i onClick="hello();">
+"
+string(8) "aaaaqqqq"
+string(23) "aaafunction foo() {}qqq"
+bool(false)
+string(6) "asdasd"
+string(0) ""
+bool(false)
+bool(false)
+string(11) "some text
+"
+string(4) "blah"
+string(24) "some another text hoho "
+bool(false)
+string(9) "askasdfas"
+string(6) "dfaaaa"
+string(5) "asdqw"
+string(0) ""
+string(3) "aaa"
+string(9) "t>functio"
+string(6) "asdasd"
+string(0) ""
+bool(false)
+bool(false)
+string(9) "some text"
+string(2) "
+"
+string(9) "some anot"
+string(9) "her text "
+Done
diff --git a/ext/standard/tests/file/file_put_contents.phpt b/ext/standard/tests/file/file_put_contents.phpt
index de08141b8..4566c3756 100644
--- a/ext/standard/tests/file/file_put_contents.phpt
+++ b/ext/standard/tests/file/file_put_contents.phpt
@@ -2,13 +2,18 @@
file_put_contents() and invalid parameters
--FILE--
<?php
-
+class foo {
+ function __toString() {
+ return __METHOD__;
+ }
+}
$file = dirname(__FILE__)."/file_put_contents.txt";
$context = stream_context_create();
var_dump(file_put_contents($file, $context));
var_dump(file_put_contents($file, new stdClass));
+var_dump(file_put_contents($file, new foo));
$fp = fopen($file, "r");
var_dump(file_put_contents($file, "string", 0, $fp));
@@ -19,9 +24,8 @@ echo "Done\n";
--EXPECTF--
Warning: file_put_contents(): supplied resource is not a valid stream resource in %s on line %d
bool(false)
-
-Warning: file_put_contents(): The 2nd parameter should be either a string or an array in %s on line %d
bool(false)
+int(15)
Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d
int(6)
diff --git a/ext/standard/tests/file/filestat.phpt b/ext/standard/tests/file/filestat.phpt
new file mode 100644
index 000000000..d02f9f2a1
--- /dev/null
+++ b/ext/standard/tests/file/filestat.phpt
@@ -0,0 +1,63 @@
+--TEST--
+various file stat func tests
+--FILE--
+<?php
+
+var_dump(fileinode("."));
+var_dump(fileowner("."));
+var_dump(filegroup("."));
+var_dump(fileatime("."));
+var_dump(filectime("."));
+
+var_dump(fileinode("./.."));
+var_dump(fileowner("./.."));
+var_dump(filegroup("./.."));
+var_dump(fileatime("./.."));
+var_dump(filectime("./.."));
+
+var_dump(fileinode(__FILE__));
+var_dump(fileowner(__FILE__));
+var_dump(filegroup(__FILE__));
+var_dump(fileatime(__FILE__));
+var_dump(filectime(__FILE__));
+
+var_dump(fileinode("/no/such/file/or/dir"));
+var_dump(fileowner("/no/such/file/or/dir"));
+var_dump(filegroup("/no/such/file/or/dir"));
+var_dump(fileatime("/no/such/file/or/dir"));
+var_dump(filectime("/no/such/file/or/dir"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+
+Warning: fileinode(): stat failed for /no/such/file/or/dir in %s on line %d
+bool(false)
+
+Warning: fileowner(): stat failed for /no/such/file/or/dir in %s on line %d
+bool(false)
+
+Warning: filegroup(): stat failed for /no/such/file/or/dir in %s on line %d
+bool(false)
+
+Warning: fileatime(): stat failed for /no/such/file/or/dir in %s on line %d
+bool(false)
+
+Warning: filectime(): stat failed for /no/such/file/or/dir in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt
new file mode 100644
index 000000000..efc059cff
--- /dev/null
+++ b/ext/standard/tests/file/flock.phpt
@@ -0,0 +1,64 @@
+--TEST--
+flock() tests
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/flock.dat";
+
+var_dump(flock());
+var_dump(flock("", "", $var));
+
+$fp = fopen($file, "w");
+fclose($fp);
+
+var_dump(flock($fp, LOCK_SH|LOCK_NB));
+
+$fp = fopen($file, "w");
+
+var_dump(flock($fp, LOCK_SH|LOCK_NB));
+var_dump(flock($fp, LOCK_UN));
+var_dump(flock($fp, LOCK_EX));
+var_dump(flock($fp, LOCK_UN));
+
+$would = array(1,2,3);
+var_dump(flock($fp, LOCK_SH|LOCK_NB, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_UN, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_EX, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_UN, $would));
+var_dump($would);
+
+var_dump(flock($fp, -1));
+var_dump(flock($fp, 0));
+
+@unlink($file);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+
+Warning: flock(): %d is not a valid stream resource in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt
new file mode 100644
index 000000000..67bd8ee10
--- /dev/null
+++ b/ext/standard/tests/file/fscanf.phpt
@@ -0,0 +1,100 @@
+--TEST--
+fscanf() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/fscanf.dat";
+
+var_dump(fscanf());
+var_dump(fscanf(array()));
+var_dump(fscanf(array(), array(), new stdclass));
+
+file_put_contents($filename, "data");
+
+$fp = fopen($filename, "r");
+var_dump(fscanf($fp, "%d", $v));
+var_dump($v);
+fclose($fp);
+
+$fp = fopen($filename, "r");
+var_dump(fscanf($fp, "%s", $v));
+var_dump($v);
+fclose($fp);
+
+$fp = fopen($filename, "r");
+var_dump(fscanf($fp, "%s", $v, $v1));
+var_dump($v);
+var_dump($v1);
+fclose($fp);
+
+$v = array();
+$v1 = array();
+$fp = fopen($filename, "r");
+var_dump(fscanf($fp, "", $v, $v1));
+var_dump($v);
+var_dump($v1);
+fclose($fp);
+
+$v = array();
+$v1 = array();
+$fp = fopen($filename, "r");
+var_dump(fscanf($fp, "%.a", $v, $v1));
+var_dump($v);
+var_dump($v1);
+fclose($fp);
+
+@unlink($filename);
+touch($filename);
+
+$fp = fopen($filename, "r");
+var_dump(fscanf($fp, "%s", $v));
+var_dump($v);
+fclose($fp);
+
+file_put_contents($filename, "data");
+
+$fp = fopen($filename, "r");
+var_dump(fscanf($fp, "%s%d", $v));
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for fscanf() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for fscanf() in %s on line %d
+NULL
+
+Warning: fscanf(): supplied argument is not a valid File-Handle resource in %s on line %d
+bool(false)
+int(0)
+NULL
+int(1)
+string(4) "data"
+
+Warning: fscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
+int(-1)
+string(4) "data"
+NULL
+
+Warning: fscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
+int(-1)
+array(0) {
+}
+array(0) {
+}
+
+Warning: fscanf(): Bad scan conversion character "." in %s on line %d
+int(-1)
+array(0) {
+}
+array(0) {
+}
+bool(false)
+array(0) {
+}
+
+Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d
+int(-1)
+Done
diff --git a/ext/standard/tests/file/fstat.phpt b/ext/standard/tests/file/fstat.phpt
new file mode 100644
index 000000000..e1ae3e20b
--- /dev/null
+++ b/ext/standard/tests/file/fstat.phpt
@@ -0,0 +1,74 @@
+--TEST--
+fstat() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/fstat.dat";
+
+$fp = fopen($filename, "w");
+var_dump(fstat($fp));
+fclose($fp);
+var_dump(fstat($fp));
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+array(26) {
+ [0]=>
+ int(%i)
+ [1]=>
+ int(%i)
+ [2]=>
+ int(%i)
+ [3]=>
+ int(%i)
+ [4]=>
+ int(%i)
+ [5]=>
+ int(%i)
+ [6]=>
+ int(%i)
+ [7]=>
+ int(%i)
+ [8]=>
+ int(%i)
+ [9]=>
+ int(%i)
+ [10]=>
+ int(%i)
+ [11]=>
+ int(%i)
+ [12]=>
+ int(%i)
+ ["dev"]=>
+ int(%i)
+ ["ino"]=>
+ int(%i)
+ ["mode"]=>
+ int(%i)
+ ["nlink"]=>
+ int(%i)
+ ["uid"]=>
+ int(%i)
+ ["gid"]=>
+ int(%i)
+ ["rdev"]=>
+ int(%i)
+ ["size"]=>
+ int(%i)
+ ["atime"]=>
+ int(%i)
+ ["mtime"]=>
+ int(%i)
+ ["ctime"]=>
+ int(%i)
+ ["blksize"]=>
+ int(%i)
+ ["blocks"]=>
+ int(%i)
+}
+
+Warning: fstat(): %d is not a valid stream resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/ftruncate.phpt b/ext/standard/tests/file/ftruncate.phpt
new file mode 100644
index 000000000..8954ef12f
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate.phpt
Binary files differ
diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt
new file mode 100644
index 000000000..ba9b5013f
--- /dev/null
+++ b/ext/standard/tests/file/fwrite.phpt
@@ -0,0 +1,50 @@
+--TEST--
+fwrite() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/fwrite.dat";
+
+$fp = fopen($filename, "w");
+var_dump(fwrite($fp));
+var_dump(fwrite($fp, array()));
+fclose($fp);
+
+$fp = fopen($filename, "r");
+var_dump(fwrite($fp, "data"));
+
+$fp = fopen($filename, "w");
+var_dump(fwrite($fp, "data", -1));
+var_dump(fwrite($fp, "data", 100000));
+fclose($fp);
+
+var_dump(fwrite($fp, "data", -1));
+
+var_dump(fwrite(array(), "data", -1));
+var_dump(fwrite(array(), "data"));
+var_dump(fwrite(array()));
+
+var_dump(file_get_contents($filename));
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for fwrite() in %s on line %d
+NULL
+
+Notice: Array to string conversion in %s on line %d
+int(5)
+int(0)
+int(0)
+int(4)
+int(0)
+int(0)
+
+Warning: fwrite(): supplied argument is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for fwrite() in %s on line %d
+NULL
+string(4) "data"
+Done
diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt
new file mode 100644
index 000000000..7c721303d
--- /dev/null
+++ b/ext/standard/tests/file/get_current_user.phpt
@@ -0,0 +1,15 @@
+--TEST--
+get_current_user() tests
+--FILE--
+<?php
+
+var_dump(get_current_user("blah"));
+var_dump(get_current_user());
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for get_current_user() in %s on line %d
+NULL
+string(%d) %s
+Done
diff --git a/ext/standard/tests/file/magic_quotes.phpt b/ext/standard/tests/file/magic_quotes.phpt
new file mode 100644
index 000000000..4956f63aa
--- /dev/null
+++ b/ext/standard/tests/file/magic_quotes.phpt
@@ -0,0 +1,61 @@
+--TEST--
+various magic quotes tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/magic_quotes.dat";
+
+var_dump(get_magic_quotes_runtime());
+var_dump(get_magic_quotes_runtime("blah"));
+
+file_put_contents($filename, "some'content'here\"and}there");
+
+var_dump(set_magic_quotes_runtime(true));
+var_dump(get_magic_quotes_runtime());
+var_dump(set_magic_quotes_runtime(-1));
+var_dump(get_magic_quotes_runtime());
+
+var_dump(file_get_contents($filename));
+
+var_dump(set_magic_quotes_runtime(0));
+var_dump(get_magic_quotes_runtime());
+
+var_dump(file_get_contents($filename));
+
+var_dump(set_magic_quotes_runtime(1));
+var_dump(get_magic_quotes_runtime());
+
+file_put_contents($filename, "some'content'here\"and}there");
+
+var_dump(file_get_contents($filename));
+
+var_dump(set_magic_quotes_runtime(0));
+var_dump(set_magic_quotes_runtime());
+var_dump(get_magic_quotes_runtime());
+
+var_dump(file_get_contents($filename));
+
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(0)
+int(0)
+bool(true)
+int(1)
+bool(true)
+int(1)
+string(30) "some\'content\'here\"and}there"
+bool(true)
+int(0)
+string(27) "some'content'here"and}there"
+bool(true)
+int(1)
+string(30) "some\'content\'here\"and}there"
+bool(true)
+bool(false)
+int(0)
+string(27) "some'content'here"and}there"
+Done
diff --git a/ext/standard/tests/file/mkdir-002.phpt b/ext/standard/tests/file/mkdir-002.phpt
index bc4f19aca..ccfd6c3d7 100644
--- a/ext/standard/tests/file/mkdir-002.phpt
+++ b/ext/standard/tests/file/mkdir-002.phpt
@@ -1,5 +1,11 @@
--TEST--
mkdir(dir, 0777) tests
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
--FILE--
<?php
diff --git a/ext/standard/tests/file/mkdir-006.phpt b/ext/standard/tests/file/mkdir-006.phpt
index 5bfa8e814..9fcb92802 100644
--- a/ext/standard/tests/file/mkdir-006.phpt
+++ b/ext/standard/tests/file/mkdir-006.phpt
@@ -1,11 +1,5 @@
--TEST--
recursive mkdir() with unclean paths
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip only for Windows');
-}
-?>
--FILE--
<?php
chdir(dirname(__FILE__));
diff --git a/ext/standard/tests/file/proc_open01.phpt b/ext/standard/tests/file/proc_open01.phpt
index c5b0ed971..2c211f616 100644
--- a/ext/standard/tests/file/proc_open01.phpt
+++ b/ext/standard/tests/file/proc_open01.phpt
@@ -32,7 +32,7 @@ for ($left = strlen($test_string); $left > 0;) {
$read_fds = array($pipes[1]);
$write_fds = NULL;
$exp_fds = NULL;
- $retval = stream_select($read_fds, $write_fds, $exp_fds, 1);
+ $retval = stream_select($read_fds, $write_fds, $exp_fds, 5);
if ($retval === false) {
print "select() failed\n";
break;
diff --git a/ext/standard/tests/file/statpage.phpt b/ext/standard/tests/file/statpage.phpt
new file mode 100644
index 000000000..f11be9734
--- /dev/null
+++ b/ext/standard/tests/file/statpage.phpt
@@ -0,0 +1,20 @@
+--TEST--
+getlastmod() and others
+--FILE--
+<?php
+
+var_dump(getlastmod());
+var_dump(getmyinode());
+var_dump(getmyuid());
+var_dump(getmypid());
+var_dump(getmygid());
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+Done
diff --git a/ext/standard/tests/file/stream_001.phpt b/ext/standard/tests/file/stream_001.phpt
index 8a3f03409..6df43471e 100644
--- a/ext/standard/tests/file/stream_001.phpt
+++ b/ext/standard/tests/file/stream_001.phpt
@@ -17,7 +17,7 @@ Notice: fopen(): Unable to find the wrapper "file" - did you forget to enable it
Warning: fopen(): Plainfiles wrapper disabled in %s on line %d
-Warning: fopen(file:///%s): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://%s): failed to open stream: no suitable wrapper could be found in %s on line %d
bool(false)
bool(true)
resource(%d) of type (stream)
diff --git a/ext/standard/tests/file/stream_002.phpt b/ext/standard/tests/file/stream_002.phpt
index ae10abf2d..e982f704c 100644
--- a/ext/standard/tests/file/stream_002.phpt
+++ b/ext/standard/tests/file/stream_002.phpt
@@ -31,10 +31,10 @@ bool(false)
int(0)
string(27) "Failed to parse address "[""
-Warning: stream_socket_client(): unable to connect to [ (Failed to parse IPv6 address "[ ") in %s on line %d
+Warning: stream_socket_client(): unable to connect to [ (Failed to parse%saddress "[ ") in %s on line %d
bool(false)
int(0)
-string(33) "Failed to parse IPv6 address "[ ""
+string(%d) "Failed to parse%saddress "[ ""
Warning: stream_socket_client(): unable to connect to . (Failed to parse address ".") in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/symlink.phpt b/ext/standard/tests/file/symlink.phpt
new file mode 100644
index 000000000..489c26644
--- /dev/null
+++ b/ext/standard/tests/file/symlink.phpt
@@ -0,0 +1,78 @@
+--TEST--
+symlink() & friends
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/symlink.dat";
+$link = dirname(__FILE__)."/symlink.link";
+
+var_dump(symlink($filename, $link));
+var_dump(readlink($link));
+var_dump(linkinfo($link));
+@unlink($link);
+
+var_dump(readlink($link));
+var_dump(linkinfo($link));
+
+touch($filename);
+var_dump(symlink($filename, dirname(__FILE__)));
+@unlink($link);
+
+var_dump(symlink($filename, $link));
+@unlink($link);
+
+touch($link);
+var_dump(symlink($filename, $link));
+@unlink($link);
+
+var_dump(link($filename, $link));
+@unlink($filename);
+
+var_dump(link($filename, $link));
+@unlink($link);
+
+var_dump(symlink(".", "."));
+var_dump(link(".", "."));
+var_dump(readlink("."));
+var_dump(linkinfo("."));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+string(%d) "%ssymlink.dat"
+int(%d)
+
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: linkinfo(): No such file or directory in %s on line %d
+int(-1)
+
+Warning: symlink(): File exists in %s on line %d
+bool(false)
+bool(true)
+
+Warning: symlink(): File exists in %s on line %d
+bool(false)
+bool(true)
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: symlink(): %s in %s on line %d
+bool(false)
+
+Warning: link(): %s in %s on line %d
+bool(false)
+
+Warning: readlink(): Invalid argument in %s on line %d
+bool(false)
+int(%d)
+Done
diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt
new file mode 100644
index 000000000..504674f17
--- /dev/null
+++ b/ext/standard/tests/file/touch.phpt
@@ -0,0 +1,49 @@
+--TEST--
+touch() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/touch.dat";
+
+var_dump(touch());
+var_dump(touch($filename));
+var_dump(filemtime($filename));
+@unlink($filename);
+var_dump(touch($filename, 101));
+var_dump(filemtime($filename));
+
+@unlink($filename);
+var_dump(touch($filename, -1));
+var_dump(filemtime($filename));
+
+@unlink($filename);
+var_dump(touch($filename, 100, 100));
+var_dump(filemtime($filename));
+
+@unlink($filename);
+var_dump(touch($filename, 100, -100));
+var_dump(filemtime($filename));
+
+var_dump(touch("/no/such/file/or/directory"));
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for touch() in %s on line %d
+NULL
+bool(true)
+int(%d)
+bool(true)
+int(101)
+bool(true)
+int(%i)
+bool(true)
+int(100)
+bool(true)
+int(100)
+
+Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt
index 164bd7fb2..bfd82e55b 100644
--- a/ext/standard/tests/general_functions/001.phpt
+++ b/ext/standard/tests/general_functions/001.phpt
@@ -61,7 +61,7 @@ sprintf octal binary test: passed
sprintf float test: passed
99.00
99.00
-1.23400e-18
-1.23400e+18
-9.84324e+6
--9.84324e+6
+1.234000e-18
+1.234000e+18
+9.843243e+6
+-9.843243e+6
diff --git a/ext/standard/tests/general_functions/bug27678.phpt b/ext/standard/tests/general_functions/bug27678.phpt
index ec9cf93cf..5db5890a1 100644
--- a/ext/standard/tests/general_functions/bug27678.phpt
+++ b/ext/standard/tests/general_functions/bug27678.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #27678 (number_format() crashes with large numbers)
+Bug #27678 (number_format() crashes with large numbers)
--FILE--
<?php
diff --git a/ext/standard/tests/general_functions/bug34794.phpt b/ext/standard/tests/general_functions/bug34794.phpt
new file mode 100644
index 000000000..3aacf7e51
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug34794.phpt
@@ -0,0 +1,34 @@
+--TEST--
+bug #34794: proc_close() hangs when used with two processes
+--SKIPIF--
+<?php
+if (!is_executable('/bin/cat')) echo 'skip cat not found';
+?>
+--FILE--
+<?php
+echo "Opening process 1\n";
+$process1 = proc_open('/bin/cat', array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes1);
+
+echo "Opening process 2\n";
+$process2 = proc_open('/bin/cat', array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes2);
+
+
+echo "Closing process 1\n";
+fclose($pipes1[0]);
+fclose($pipes1[1]);
+proc_close($process1);
+
+echo "Closing process 2\n";
+fclose($pipes2[0]);
+fclose($pipes2[1]);
+proc_close($process2);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Opening process 1
+Opening process 2
+Closing process 1
+Closing process 2
+Done
diff --git a/ext/standard/tests/general_functions/bug39322.phpt b/ext/standard/tests/general_functions/bug39322.phpt
new file mode 100644
index 000000000..cb3459995
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug39322.phpt
@@ -0,0 +1,44 @@
+--TEST--
+bug #39322: proc_terminate() loosing process resource
+--SKIPIF--
+<?php
+if (!is_executable('/bin/sleep')) echo 'skip sleep not found';
+?>
+--FILE--
+<?php
+$descriptors = array(
+ 0 => array('pipe', 'r'),
+ 1 => array('pipe', 'w'),
+ 2 => array('pipe', 'w'));
+
+$pipes = array();
+
+$process = proc_open('/bin/sleep 120', $descriptors, $pipes);
+
+proc_terminate($process);
+sleep(1); // wait a bit to let the process finish
+var_dump(proc_get_status($process));
+
+echo "Done!\n";
+
+?>
+--EXPECTF--
+array(8) {
+ ["command"]=>
+ string(14) "/bin/sleep 120"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(false)
+ ["signaled"]=>
+ bool(true)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(15)
+ ["stopsig"]=>
+ int(0)
+}
+Done!
diff --git a/ext/standard/tests/general_functions/bug40398.phpt b/ext/standard/tests/general_functions/bug40398.phpt
new file mode 100755
index 000000000..ab3cc2a2b
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug40398.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Bug #40398 (parent and self callback functions erroneously called statically)
+--FILE--
+<?php
+
+class Base
+{
+ function __construct($msg)
+ {
+ echo __METHOD__ . "($msg)\n";
+ }
+}
+
+class Derived_1 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'Base::__construct'), $args);
+ }
+}
+
+class Derived_2 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'parent::__construct'), $args);
+ }
+}
+
+class Derived_3 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array('Base::__construct', $args);
+ }
+}
+
+class Derived_4 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array('parent::__construct', $args);
+ }
+}
+
+class Derived_5 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array('Base', '__construct'), $args);
+ }
+}
+
+class Derived_6 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array('parent', '__construct'), $args);
+ }
+}
+
+new Derived_1('1');
+new Derived_2('2');
+new Derived_3('3');
+new Derived_4('4');
+new Derived_5('5');
+new Derived_6('6');
+
+?>
+===DONE===
+--EXPECTF--
+Base::__construct(1)
+Base::__construct(2)
+
+Warning: call_user_func_array(): First argument is expected to be a valid callback, 'Base::__construct' was given in %sbug40398.php on line %d
+
+Warning: call_user_func_array(): First argument is expected to be a valid callback, 'parent::__construct' was given in %sbug40398.php on line %d
+
+Strict Standards: Non-static method Base::__construct() cannot be called statically, assuming $this from compatible context Derived_5 in %sbug40398.php on line %d
+Base::__construct(5)
+
+Strict Standards: Non-static method Base::__construct() cannot be called statically, assuming $this from compatible context Derived_6 in %sbug40398.php on line %d
+Base::__construct(6)
+===DONE===
diff --git a/ext/standard/tests/general_functions/bug40752.phpt b/ext/standard/tests/general_functions/bug40752.phpt
new file mode 100644
index 000000000..30ed8a4aa
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug40752.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #40752 (parse_ini_file() segfaults when a scalar setting is redeclared as an array)
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/bug40752.ini";
+file_put_contents($file, '
+foo = 1;
+foo[] = 1;
+');
+
+var_dump(parse_ini_file($file));
+
+file_put_contents($file, '
+foo[] = 1;
+foo = 1;
+');
+
+var_dump(parse_ini_file($file));
+
+unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(1) {
+ ["foo"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+array(1) {
+ ["foo"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/standard/tests/general_functions/bug41037.phpt b/ext/standard/tests/general_functions/bug41037.phpt
new file mode 100644
index 000000000..eab2c334c
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41037.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #41037 (unregister_tick_function() inside the tick function crash PHP)
+--FILE--
+<?php
+
+function a() {
+ echo "hello";
+ unregister_tick_function('a');
+}
+
+declare (ticks=1);
+register_tick_function('a');
+
+echo "Done\n";
+?>
+--EXPECTF--
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
+Done
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt
new file mode 100644
index 000000000..3ce1339d1
--- /dev/null
+++ b/ext/standard/tests/general_functions/error_get_last.phpt
@@ -0,0 +1,43 @@
+--TEST--
+error_get_last() tests
+--FILE--
+<?php
+
+var_dump(error_get_last());
+var_dump(error_get_last(true));
+var_dump(error_get_last());
+
+$a = $b;
+
+var_dump(error_get_last());
+
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+
+Warning: Wrong parameter count for error_get_last() in %s on line %d
+NULL
+array(4) {
+ ["type"]=>
+ int(2)
+ ["message"]=>
+ string(42) "Wrong parameter count for error_get_last()"
+ ["file"]=>
+ string(%d) "%s"
+ ["line"]=>
+ int(%d)
+}
+
+Notice: Undefined variable: b in %s on line %d
+array(4) {
+ ["type"]=>
+ int(8)
+ ["message"]=>
+ string(21) "Undefined variable: b"
+ ["file"]=>
+ string(%d) "%s"
+ ["line"]=>
+ int(%d)
+}
+Done
diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt
new file mode 100644
index 000000000..55abbac37
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage.phpt
@@ -0,0 +1,23 @@
+--TEST--
+getrusage() tests
+--SKIPIF--
+<?php if (!function_exists("getrusage")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gettype(getrusage()));
+var_dump(gettype(getrusage(1)));
+var_dump(gettype(getrusage(-1)));
+var_dump(getrusage(array()));
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+string(5) "array"
+string(5) "array"
+
+Warning: getrusage() expects parameter 1 to be long, array given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt
new file mode 100644
index 000000000..e83bbf6ac
--- /dev/null
+++ b/ext/standard/tests/general_functions/head.phpt
@@ -0,0 +1,53 @@
+--TEST--
+header() and friends
+--SKIPIF--
+<?php
+if (php_sapi_name() != "cli") {
+ die("skip this test is for CLI");
+}
+?>
+--FILE--
+<?php
+
+$v1 = headers_sent();
+$v2 = headers_list();
+var_dump(header("HTTP 1.0", true, 200));
+
+var_dump($v1);
+var_dump($v2);
+
+var_dump(header(""));
+var_dump(header("", true));
+var_dump(headers_sent());
+var_dump(headers_list());
+var_dump(header("HTTP blah"));
+var_dump(header("HTTP blah", true));
+var_dump(headers_sent());
+var_dump(headers_list());
+
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+bool(false)
+array(0) {
+}
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+bool(true)
+array(0) {
+}
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+bool(true)
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/general_functions/highlight_heredoc.phpt b/ext/standard/tests/general_functions/highlight_heredoc.phpt
index 58f83806a..ee4e2e828 100644
--- a/ext/standard/tests/general_functions/highlight_heredoc.phpt
+++ b/ext/standard/tests/general_functions/highlight_heredoc.phpt
@@ -1,5 +1,7 @@
--TEST--
highlight_string() handling of heredoc
+--INI--
+highlight.html=#000000
--FILE--
<?php
$str = '
diff --git a/ext/standard/tests/general_functions/import_request.phpt b/ext/standard/tests/general_functions/import_request.phpt
new file mode 100644
index 000000000..23dc049db
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request.phpt
@@ -0,0 +1,78 @@
+--TEST--
+import_request_variables() tests
+--GET--
+a=1&b=heh&c=3&d[]=5&GLOBALS=test&1=hm
+--POST--
+ap=25&bp=test&cp=blah3&dp[]=ar
+--FILE--
+<?php
+
+var_dump(import_request_variables());
+var_dump(import_request_variables(""));
+var_dump(import_request_variables("", ""));
+
+var_dump(import_request_variables("g", ""));
+var_dump($a, $b, $c, $ap);
+
+var_dump(import_request_variables("g", "g_"));
+var_dump($g_a, $g_b, $g_c, $g_ap, $g_1);
+
+var_dump(import_request_variables("GP", "i_"));
+var_dump($i_a, $i_b, $i_c, $i_ap, $i_bp, $i_cp, $i_dp);
+
+var_dump(import_request_variables("gGg", "r_"));
+var_dump($r_a, $r_b, $r_c, $r_ap);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for import_request_variables() in %s on line %d
+NULL
+
+Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
+NULL
+
+Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
+NULL
+
+Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
+
+Warning: import_request_variables(): Attempted GLOBALS variable overwrite. in %s on line %d
+
+Warning: import_request_variables(): Numeric key detected - possible security hazard. in %s on line %d
+NULL
+
+Notice: Undefined variable: ap in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+NULL
+
+Notice: Undefined variable: g_ap in %s on line %d
+
+Notice: Undefined variable: g_1 in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+NULL
+NULL
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+string(2) "25"
+string(4) "test"
+string(5) "blah3"
+array(1) {
+ [0]=>
+ string(2) "ar"
+}
+NULL
+
+Notice: Undefined variable: r_ap in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt
new file mode 100644
index 000000000..12d7c3f22
--- /dev/null
+++ b/ext/standard/tests/general_functions/include_path.phpt
@@ -0,0 +1,75 @@
+--TEST--
+*_include_path() tests
+--INI--
+include_path=.
+--FILE--
+<?php
+
+var_dump(get_include_path());
+var_dump(get_include_path("var"));
+
+var_dump(restore_include_path());
+var_dump(restore_include_path(""));
+
+
+var_dump(set_include_path());
+var_dump(get_include_path());
+var_dump(set_include_path("var"));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(".:/path/to/dir"));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(""));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(array()));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "."
+
+Warning: Wrong parameter count for get_include_path() in %s on line %d
+NULL
+NULL
+
+Warning: Wrong parameter count for restore_include_path() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for set_include_path() in %s on line %d
+NULL
+string(1) "."
+string(1) "."
+string(3) "var"
+NULL
+string(1) "."
+string(1) "."
+string(14) ".:/path/to/dir"
+NULL
+string(1) "."
+string(1) "."
+string(1) "."
+NULL
+string(1) "."
+
+Notice: Array to string conversion in %s on line %d
+string(1) "."
+string(5) "Array"
+NULL
+string(1) "."
+Done
diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt
new file mode 100644
index 000000000..6016873fd
--- /dev/null
+++ b/ext/standard/tests/general_functions/ini_get_all.phpt
@@ -0,0 +1,51 @@
+--TEST--
+ini_get_all() tests
+--SKIPIF--
+<?php if (!extension_loaded("pcre")) die("skip"); ?>
+--FILE--
+<?php
+
+var_dump(gettype(ini_get_all()));
+var_dump(ini_get_all(""));
+var_dump(ini_get_all("nosuchextension"));
+var_dump(ini_get_all("reflection"));
+var_dump(ini_get_all("pcre"));
+
+var_dump(ini_get_all("", ""));
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+
+Warning: ini_get_all(): Unable to find extension '' in %s on line %d
+bool(false)
+
+Warning: ini_get_all(): Unable to find extension 'nosuchextension' in %s on line %d
+bool(false)
+array(0) {
+}
+array(2) {
+ ["pcre.backtrack_limit"]=>
+ array(3) {
+ ["global_value"]=>
+ string(6) "100000"
+ ["local_value"]=>
+ string(6) "100000"
+ ["access"]=>
+ int(7)
+ }
+ ["pcre.recursion_limit"]=>
+ array(3) {
+ ["global_value"]=>
+ string(6) "100000"
+ ["local_value"]=>
+ string(6) "100000"
+ ["access"]=>
+ int(7)
+ }
+}
+
+Warning: ini_get_all() expects at most 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt
new file mode 100644
index 000000000..399a224db
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_file.phpt
@@ -0,0 +1,175 @@
+--TEST--
+parse_ini_file() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/parse_ini_file.dat";
+
+var_dump(parse_ini_file());
+var_dump(parse_ini_file(1,1,1));
+var_dump(parse_ini_file($filename));
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+test =
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+test==
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+test=test=
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+test= \"new
+line\"
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+define("TEST_CONST", "test const value");
+$ini = "
+test=TEST_CONST
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+[section]
+test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, false));
+
+$ini = "
+section.test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+section.test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+1=2
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+1=2
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+test=test2
+test=test3
+test=test4
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for parse_ini_file() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for parse_ini_file() in %s on line %d
+NULL
+
+Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s on line %d
+array(0) {
+}
+
+Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s on line %d
+array(0) {
+}
+array(1) {
+ ["test"]=>
+ string(0) ""
+}
+
+Warning: Error parsing %sparse_ini_file.dat on line 2
+ in %s on line %d
+array(1) {
+ ["test"]=>
+ string(0) ""
+}
+
+Warning: Error parsing %sparse_ini_file.dat on line 2
+ in %s on line %d
+array(1) {
+ ["test"]=>
+ string(4) "test"
+}
+array(1) {
+ ["test"]=>
+ string(8) "new
+line"
+}
+array(1) {
+ ["test"]=>
+ string(16) "test const value"
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ ["test"]=>
+ string(5) "hello"
+ }
+}
+array(1) {
+ ["test"]=>
+ string(5) "hello"
+}
+array(1) {
+ ["section.test"]=>
+ string(5) "hello"
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ ["section.test"]=>
+ string(5) "hello"
+ }
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ [1]=>
+ string(1) "2"
+ }
+}
+array(1) {
+ [1]=>
+ string(1) "2"
+}
+array(1) {
+ ["test"]=>
+ string(5) "test4"
+}
+Done
diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt
new file mode 100644
index 000000000..2a8acc9a8
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpcredits.phpt
@@ -0,0 +1,54 @@
+--TEST--
+phpcredits()
+--FILE--
+<?php
+
+var_dump(phpcredits());
+var_dump(phpcredits(array()));
+
+echo "--\n";
+var_dump(phpcredits(0));
+
+echo "--\n";
+var_dump(phpcredits(CREDITS_GROUP));
+
+?>
+--EXPECTF--
+PHP Credits
+
+PHP Group
+%s
+
+Language Design & Concept
+%s
+
+%wPHP %d Authors%w
+%s
+
+%wSAPI Modules%w
+%s
+
+%wModule Authors%w
+%s
+
+%wPHP Documentation%w
+%s
+
+PHP Quality Assurance Team
+%s
+
+PHP Website Team
+%s
+bool(true)
+
+Warning: phpcredits() expects parameter 1 to be long, array given in %sphpcredits.php on line 4
+NULL
+--
+PHP Credits
+bool(true)
+--
+PHP Credits
+
+PHP Group
+%s
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt
new file mode 100644
index 000000000..e3b6e354d
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpcredits2.phpt
@@ -0,0 +1,32 @@
+--TEST--
+phpcredits() CGI
+--SKIPIF--
+<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
+--POST--
+dummy=x
+--FILE--
+<?php
+
+var_dump(phpcredits());
+var_dump(phpcredits(array()));
+
+echo "--\n";
+var_dump(phpcredits(0));
+
+echo "--\n";
+var_dump(phpcredits(CREDITS_GROUP));
+
+?>
+--EXPECTF--
+<!DOCTYPE %s>%s</html>
+bool(true)
+
+Warning: phpcredits() expects parameter 1 to be long, array given in %sphpcredits2.php on line 4
+NULL
+--
+<h1>PHP Credits</h1>
+bool(true)
+--
+<h1>PHP Credits</h1>
+%sPHP Group%s
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt
new file mode 100644
index 000000000..dab7f327c
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -0,0 +1,75 @@
+--TEST--
+phpinfo()
+--FILE--
+<?php
+var_dump(phpinfo());
+
+echo "--\n";
+var_dump(phpinfo(array()));
+
+echo "--\n";
+var_dump(phpinfo(0));
+
+echo "--\n";
+var_dump(phpinfo(INFO_LICENSE));
+
+?>
+--EXPECTF--
+phpinfo()
+PHP Version => %s
+
+System => %s
+Build Date => %s
+Configure Command => %s
+Server API => Command Line Interface
+Virtual Directory Support => %s
+Configuration File (php.ini) Path => %s
+PHP API => %d
+PHP Extension => %d
+Zend Extension => %d
+Debug Build => %s
+Thread Safety => %s
+Zend Memory Manager => %s
+IPv6 Support => %s
+Registered PHP Streams => %s
+Registered Stream Socket Transports => %s
+Registered Stream Filters => %s
+
+%s
+ _______________________________________________________________________
+
+
+Configuration
+
+PHP Core
+
+%s
+
+Additional Modules
+
+%s
+
+Environment
+
+%s
+
+PHP Variables
+
+%s
+
+PHP License
+%s
+bool(true)
+--
+
+Warning: phpinfo() expects parameter 1 to be long, array given in %sphpinfo.php on line 5
+NULL
+--
+phpinfo()
+bool(true)
+--
+phpinfo()
+
+PHP License
+%s
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt
new file mode 100644
index 000000000..ba9cc28ab
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpinfo2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+phpinfo() CGI
+--SKIPIF--
+<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
+--POST--
+dummy=x
+--FILE--
+<?php
+var_dump(phpinfo());
+
+echo "--\n";
+var_dump(phpinfo(array()));
+
+echo "--\n";
+var_dump(phpinfo(0));
+
+echo "--\n";
+var_dump(phpinfo(INFO_LICENSE));
+
+?>
+--EXPECTF--
+<!DOCTYPE %s>
+%s</html>bool(true)
+--
+
+Warning: phpinfo() expects parameter 1 to be long, array given in %sphpinfo2.php on line 5
+NULL
+--
+<!DOCTYPE %s>
+%s</html>bool(true)
+--
+<!DOCTYPE %s>
+%s</html>bool(true)
diff --git a/ext/standard/tests/general_functions/proc_open02.phpt b/ext/standard/tests/general_functions/proc_open02.phpt
new file mode 100644
index 000000000..3cba15e9a
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_open02.phpt
@@ -0,0 +1,72 @@
+--TEST--
+proc_open
+--SKIPIF--
+<?php
+if (!is_executable('/bin/sleep')) echo 'skip no sleep';
+if (!is_executable('/usr/bin/nohup')) echo 'skip no nohup';
+?>
+--FILE--
+<?php
+$ds = array(array('pipe', 'r'));
+
+$cat = proc_open(
+ '/usr/bin/nohup /bin/sleep 50',
+ $ds,
+ $pipes
+);
+
+sleep(1); // let the OS run the nohup process before sending the signal
+
+var_dump(proc_terminate($cat, 1)); // send a SIGHUP
+sleep(1);
+var_dump(proc_get_status($cat));
+
+var_dump(proc_terminate($cat)); // now really quit it
+sleep(1);
+var_dump(proc_get_status($cat));
+
+proc_close($cat);
+
+echo "Done!\n";
+
+?>
+--EXPECTF--
+bool(true)
+array(8) {
+ ["command"]=>
+ string(28) "/usr/bin/nohup /bin/sleep 50"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(true)
+ ["signaled"]=>
+ bool(false)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(0)
+ ["stopsig"]=>
+ int(0)
+}
+bool(true)
+array(8) {
+ ["command"]=>
+ string(28) "/usr/bin/nohup /bin/sleep 50"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(false)
+ ["signaled"]=>
+ bool(true)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(15)
+ ["stopsig"]=>
+ int(0)
+}
+Done!
diff --git a/ext/standard/tests/general_functions/putenv.phpt b/ext/standard/tests/general_functions/putenv.phpt
new file mode 100644
index 000000000..afe1badce
--- /dev/null
+++ b/ext/standard/tests/general_functions/putenv.phpt
@@ -0,0 +1,28 @@
+--TEST--
+putenv() basic tests
+--FILE--
+<?php
+
+$var_name="SUCHVARSHOULDNOTEXIST";
+
+var_dump(getenv($var_name));
+var_dump(putenv($var_name."=value"));
+var_dump(getenv($var_name));
+
+var_dump(putenv($var_name."="));
+var_dump(getenv($var_name));
+
+var_dump(putenv($var_name));
+var_dump(getenv($var_name));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+bool(true)
+string(5) "value"
+bool(true)
+string(0) ""
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt
new file mode 100644
index 000000000..e75bd6d37
--- /dev/null
+++ b/ext/standard/tests/general_functions/rand.phpt
@@ -0,0 +1,63 @@
+--TEST--
+rand() and mt_rand() tests
+--FILE--
+<?php
+
+var_dump(mt_rand());
+var_dump(mt_rand(-1));
+var_dump(mt_rand(-1,1));
+var_dump(mt_rand(0,3));
+
+var_dump(rand());
+var_dump(rand(-1));
+var_dump(rand(-1,1));
+var_dump(rand(0,3));
+
+var_dump(srand());
+var_dump(srand(-1));
+var_dump(srand(array()));
+
+var_dump(mt_srand());
+var_dump(mt_srand(-1));
+var_dump(mt_srand(array()));
+
+var_dump(getrandmax());
+var_dump(getrandmax(1));
+
+var_dump(mt_getrandmax());
+var_dump(mt_getrandmax(1));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+
+Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+int(%i)
+int(%d)
+int(%d)
+
+Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+int(%i)
+int(%d)
+NULL
+NULL
+
+Warning: srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+NULL
+NULL
+
+Warning: mt_srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+int(%d)
+
+Warning: Wrong parameter count for getrandmax() in %s on line %d
+NULL
+int(%d)
+
+Warning: Wrong parameter count for mt_getrandmax() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt
new file mode 100644
index 000000000..cb3a798db
--- /dev/null
+++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt
@@ -0,0 +1,32 @@
+--TEST--
+sys_getloadavg() tests
+--SKIPIF--
+<?php
+if (!function_exists("sys_getloadavg")) die("skip");
+?>
+--FILE--
+<?php
+
+var_dump(sys_getloadavg(""));
+var_dump(sys_getloadavg());
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(3) {
+ [0]=>
+ float(%f)
+ [1]=>
+ float(%f)
+ [2]=>
+ float(%f)
+}
+array(3) {
+ [0]=>
+ float(%f)
+ [1]=>
+ float(%f)
+ [2]=>
+ float(%f)
+}
+Done
diff --git a/ext/standard/tests/general_functions/type.phpt b/ext/standard/tests/general_functions/type.phpt
new file mode 100644
index 000000000..98eccbbda
--- /dev/null
+++ b/ext/standard/tests/general_functions/type.phpt
@@ -0,0 +1,351 @@
+--TEST--
+gettype(), settype() and friends
+--FILE--
+<?php
+
+function foo($errno, $errstr, $errfile, $errline) {
+ var_dump($errstr);
+}
+
+set_error_handler("foo");
+
+$fp = fopen(__FILE__, "r");
+fclose($fp);
+$fp1 = fopen(__FILE__, "r");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+$array = array(
+ array(1,2,3),
+ $var1,
+ $var2,
+ 1,
+ 2.0,
+ NULL,
+ false,
+ "some string",
+ $fp,
+ $fp1,
+ new stdclass,
+);
+
+$types = array(
+ "null",
+ "integer",
+ "double",
+ "boolean",
+ "resource",
+ "array",
+ "object",
+ "string"
+ );
+
+foreach ($array as $var) {
+ var_dump(gettype($var));
+}
+
+foreach ($types as $type) {
+ foreach ($array as $var) {
+ var_dump(settype($var, $type));
+ var_dump($var);
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+string(6) "string"
+string(5) "array"
+string(7) "integer"
+string(6) "double"
+string(4) "NULL"
+string(7) "boolean"
+string(6) "string"
+string(12) "unknown type"
+string(8) "resource"
+string(6) "object"
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+int(1)
+bool(true)
+int(0)
+bool(true)
+int(1)
+bool(true)
+int(1)
+bool(true)
+int(2)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(5)
+bool(true)
+int(6)
+string(54) "Object of class stdClass could not be converted to int"
+bool(true)
+int(%d)
+bool(true)
+float(1)
+bool(true)
+float(0)
+bool(true)
+float(1)
+bool(true)
+float(1)
+bool(true)
+float(2)
+bool(true)
+float(0)
+bool(true)
+float(0)
+bool(true)
+float(0)
+bool(true)
+float(5)
+bool(true)
+float(6)
+string(57) "Object of class stdClass could not be converted to double"
+bool(true)
+float(%d)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+string(14) "another string"
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+int(1)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+float(2)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+NULL
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+bool(false)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+string(11) "some string"
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+resource(%d) of type (Unknown)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+resource(%d) of type (stream)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+object(stdClass)#%d (0) {
+}
+bool(true)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(true)
+array(1) {
+ [0]=>
+ string(14) "another string"
+}
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ float(2)
+}
+bool(true)
+array(0) {
+}
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+bool(true)
+array(1) {
+ [0]=>
+ string(11) "some string"
+}
+bool(true)
+array(1) {
+ [0]=>
+ resource(%d) of type (Unknown)
+}
+bool(true)
+array(1) {
+ [0]=>
+ resource(%d) of type (stream)
+}
+bool(true)
+array(0) {
+}
+bool(true)
+object(stdClass)#%d (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ string(14) "another string"
+}
+bool(true)
+object(stdClass)#%d (3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ int(1)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ float(2)
+}
+bool(true)
+object(stdClass)#%d (0) {
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ bool(false)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ string(11) "some string"
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ resource(%d) of type (Unknown)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ resource(%d) of type (stream)
+}
+bool(true)
+object(stdClass)#%d (0) {
+}
+string(26) "Array to string conversion"
+bool(true)
+string(5) "Array"
+bool(true)
+string(14) "another string"
+string(26) "Array to string conversion"
+bool(true)
+string(5) "Array"
+bool(true)
+string(1) "1"
+bool(true)
+string(1) "2"
+bool(true)
+string(0) ""
+bool(true)
+string(0) ""
+bool(true)
+string(11) "some string"
+bool(true)
+string(14) "Resource id #%d"
+bool(true)
+string(14) "Resource id #%d"
+string(57) "Object of class stdClass could not be converted to string"
+string(45) "Object of class stdClass to string conversion"
+bool(true)
+string(6) "Object"
+Done
diff --git a/ext/standard/tests/math/constants.phpt b/ext/standard/tests/math/constants.phpt
index 7b5110f53..deeb785f4 100644
--- a/ext/standard/tests/math/constants.phpt
+++ b/ext/standard/tests/math/constants.phpt
@@ -1,5 +1,7 @@
--TEST--
Math constants
+--INI--
+precision=14
--FILE--
<?php
$constants = array(
diff --git a/ext/standard/tests/math/hexdec.phpt b/ext/standard/tests/math/hexdec.phpt
index d8ff71f1c..d9e644aaf 100644
--- a/ext/standard/tests/math/hexdec.phpt
+++ b/ext/standard/tests/math/hexdec.phpt
@@ -1,5 +1,7 @@
--TEST--
overflow check for _php_math_basetozval
+--INI--
+precision=14
--FILE--
<?php
diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt
new file mode 100644
index 000000000..09cf20623
--- /dev/null
+++ b/ext/standard/tests/network/inet.phpt
@@ -0,0 +1,75 @@
+--TEST--
+inet_ntop() & inet_pton() tests
+--SKIPIF--
+<?php
+if (!function_exists("inet_ntop")) die("skip no inet_ntop()");
+if (!function_exists("inet_pton")) die("skip no inet_pton()");
+?>
+--FILE--
+<?php
+
+$packed = chr(127) . chr(0) . chr(0) . chr(1);
+var_dump(inet_ntop($packed));
+
+$packed = chr(255) . chr(255) . chr(255) . chr(0);
+var_dump(inet_ntop($packed));
+
+var_dump(inet_ntop());
+var_dump(inet_ntop(-1));
+var_dump(inet_ntop(""));
+var_dump(inet_ntop("blah-blah"));
+
+var_dump(inet_pton());
+var_dump(inet_pton(""));
+var_dump(inet_pton(-1));
+var_dump(inet_pton("abra"));
+
+$array = array(
+ "127.0.0.1",
+ "66.163.161.116",
+ "255.255.255.255",
+ "0.0.0.0",
+ );
+foreach ($array as $val) {
+ var_dump($packed = inet_pton($val));
+ var_dump(inet_ntop($packed));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(9) "127.0.0.1"
+string(13) "255.255.255.0"
+
+Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: inet_ntop(): Invalid in_addr value in %s on line %d
+bool(false)
+
+Warning: inet_ntop(): Invalid in_addr value in %s on line %d
+bool(false)
+
+Warning: inet_ntop(): Invalid in_addr value in %s on line %d
+bool(false)
+
+Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: inet_pton(): Unrecognized address in %s on line %d
+bool(false)
+
+Warning: inet_pton(): Unrecognized address -1 in %s on line %d
+bool(false)
+
+Warning: inet_pton(): Unrecognized address abra in %s on line %d
+bool(false)
+string(4) "%s"
+string(9) "127.0.0.1"
+string(4) "%s"
+string(14) "66.163.161.116"
+string(4) "%s"
+string(15) "255.255.255.255"
+string(4) "%s"
+string(7) "0.0.0.0"
+Done
diff --git a/ext/standard/tests/network/inet_ipv6.phpt b/ext/standard/tests/network/inet_ipv6.phpt
new file mode 100644
index 000000000..3b280dfec
--- /dev/null
+++ b/ext/standard/tests/network/inet_ipv6.phpt
@@ -0,0 +1,50 @@
+--TEST--
+inet_ntop() & inet_pton() IPv6 tests
+--SKIPIF--
+<?php
+if (!function_exists("inet_ntop")) die("skip no inet_ntop()");
+if (!function_exists("inet_pton")) die("skip no inet_pton()");
+
+$packed = str_repeat(chr(0), 15) . chr(1);
+if (@inet_ntop($packed) === false) {
+ die("skip no IPv6 support");
+}
+if (stristr(PHP_OS, "darwin") !== false) die("skip MacOS has broken inet_*() funcs");
+?>
+--FILE--
+<?php
+
+$a = array(
+ '::1',
+ '::2',
+ '::35',
+ '::255',
+ '::1024',
+ '',
+ '2001:0db8:85a3:08d3:1319:8a2e:0370:7344',
+ '2001:0db8:1234:0000:0000:0000:0000:0000',
+ '2001:0db8:1234:FFFF:FFFF:FFFF:FFFF:FFFF',
+);
+
+foreach ($a as $address) {
+ $packed = inet_pton($address);
+ var_dump(inet_ntop($packed));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(3) "::1"
+string(3) "::2"
+string(4) "::35"
+string(5) "::255"
+string(6) "::1024"
+
+Warning: inet_pton(): Unrecognized address in %s on line %d
+
+Warning: inet_ntop(): Invalid in_addr value in %s on line %d
+bool(false)
+string(36) "2001:db8:85a3:8d3:1319:8a2e:370:7344"
+string(15) "2001:db8:1234::"
+string(38) "2001:db8:1234:ffff:ffff:ffff:ffff:ffff"
+Done
diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt
new file mode 100644
index 000000000..794c2d38c
--- /dev/null
+++ b/ext/standard/tests/network/ip.phpt
@@ -0,0 +1,67 @@
+--TEST--
+ip2long() & long2ip() tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$array = array(
+ "127.0.0.1",
+ "10.0.0.1",
+ "255.255.255.255",
+ "255.255.255.0",
+ "0.0.0.0",
+ "66.163.161.116",
+);
+
+foreach ($array as $ip) {
+ var_dump($long = ip2long($ip));
+ var_dump(long2ip($long));
+}
+
+var_dump(ip2long());
+var_dump(ip2long(""));
+var_dump(ip2long("777.777.777.777"));
+var_dump(ip2long("111.111.111.111"));
+var_dump(ip2long(array()));
+
+var_dump(long2ip());
+var_dump(long2ip(-110000));
+var_dump(long2ip(""));
+var_dump(long2ip(array()));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(2130706433)
+string(9) "127.0.0.1"
+int(167772161)
+string(8) "10.0.0.1"
+int(-1)
+string(15) "255.255.255.255"
+int(-256)
+string(13) "255.255.255.0"
+int(0)
+string(7) "0.0.0.0"
+int(1118019956)
+string(14) "66.163.161.116"
+
+Warning: Wrong parameter count for ip2long() in %s on line %d
+NULL
+int(-1)
+bool(false)
+int(1869573999)
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for long2ip() in %s on line %d
+NULL
+string(13) "255.254.82.80"
+string(7) "0.0.0.0"
+
+Notice: Array to string conversion in %s on line %d
+string(7) "0.0.0.0"
+Done
diff --git a/ext/standard/tests/network/shutdown.phpt b/ext/standard/tests/network/shutdown.phpt
new file mode 100755
index 000000000..f9ab66476
--- /dev/null
+++ b/ext/standard/tests/network/shutdown.phpt
@@ -0,0 +1,65 @@
+--TEST--
+stream_socket_shutdown() test on IPv4 TCP Loopback
+--SKIPIF--
+<?php
+ function_exists('stream_socket_shutdown') or die('skip stream_socket_shutdown() is not supported.');
+?>
+--FILE--
+<?php
+ /* Setup socket server */
+ $server = stream_socket_server('tcp://127.0.0.1:31337');
+ if (!$server) {
+ die('Unable to create AF_INET socket [server]');
+ }
+
+ /* Connect and send request 1 */
+ $client1 = stream_socket_client('tcp://127.0.0.1:31337');
+ if (!$client1) {
+ die('Unable to create AF_INET socket [client]');
+ }
+ @fwrite($client1, "Client 1\n");
+ stream_socket_shutdown($client1, STREAM_SHUT_WR);
+ @fwrite($client1, "Error 1\n");
+
+ /* Connect and send request 2 */
+ $client2 = stream_socket_client('tcp://127.0.0.1:31337');
+ if (!$client2) {
+ die('Unable to create AF_INET socket [client]');
+ }
+ @fwrite($client2, "Client 2\n");
+ stream_socket_shutdown($client2, STREAM_SHUT_WR);
+ @fwrite($client2, "Error 2\n");
+
+ /* Accept connection 1 */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+ @fwrite($socket, fgets($socket));
+ @fwrite($socket, fgets($socket));
+ fclose($socket);
+
+ /* Read Response 1 */
+ echo fgets($client1);
+ echo fgets($client1);
+
+ /* Accept connection 2 */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+ @fwrite($socket, fgets($socket));
+ @fwrite($socket, fgets($socket));
+ fclose($socket);
+
+ /* Read Response 2 */
+ echo fgets($client2);
+ echo fgets($client2);
+
+ fclose($client1);
+ fclose($client2);
+ fclose($server);
+?>
+--EXPECT--
+Client 1
+Client 2
diff --git a/ext/standard/tests/serialize/003.phpt b/ext/standard/tests/serialize/003.phpt
index 173f57b72..edbcb1f0f 100644
--- a/ext/standard/tests/serialize/003.phpt
+++ b/ext/standard/tests/serialize/003.phpt
@@ -15,11 +15,11 @@ foreach(array(1e2, 5.2e25, 85.29e-23, 9e-9) AS $value) {
d:100;
float\(100\)
-d:5\.2E\+25;
+d:5[0-9]*;
float\(5\.2E\+25\)
d:8\.52[89][0-9]+E-22;
float\(8\.529E-22\)
-d:9\.[0-9]*E-9;
+d:8\.[9]*[0-9]*E-9;
float\(9\.0E-9\)
diff --git a/ext/standard/tests/serialize/bug24063.phpt b/ext/standard/tests/serialize/bug24063.phpt
index e1cdfecf5..3cca101cb 100644
--- a/ext/standard/tests/serialize/bug24063.phpt
+++ b/ext/standard/tests/serialize/bug24063.phpt
@@ -16,8 +16,8 @@ for ($i = 1; $i < 10; $i++) {
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
+1.0E-5 1.0E-5
+1.0E-6 1.0E-6
+1.0E-7 1.0E-7
+1.0E-8 1.0E-8
+1.0E-9 1.0E-9
diff --git a/ext/standard/tests/serialize/bug31442.phpt b/ext/standard/tests/serialize/bug31442.phpt
index f508d6b98..3fd069050 100755
--- a/ext/standard/tests/serialize/bug31442.phpt
+++ b/ext/standard/tests/serialize/bug31442.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #31442 (unserialize broken on 64-bit systems)
+--INI--
+precision=14
--FILE--
<?php
echo unserialize(serialize(2147483648));
diff --git a/ext/standard/tests/serialize/unserializeS.phpt b/ext/standard/tests/serialize/unserializeS.phpt
new file mode 100755
index 000000000..633a07d21
--- /dev/null
+++ b/ext/standard/tests/serialize/unserializeS.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug MOPB-29 (wrong length calculation for S)
+--INI--
+error_reporting=0
+--FILE--
+<?php
+$str = 'S:'.(100*3).':"'.str_repeat('\61', 100).'"';
+$arr = array(str_repeat('"', 200)."1"=>1,str_repeat('"', 200)."2"=>1);
+
+$data = unserialize($str);
+var_dump($data);
+
+--EXPECT--
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
diff --git a/ext/standard/tests/strings/bug22207.phpt b/ext/standard/tests/strings/bug22207.phpt
index 688bb5b74..32a15d73c 100644
--- a/ext/standard/tests/strings/bug22207.phpt
+++ b/ext/standard/tests/strings/bug22207.phpt
@@ -6,6 +6,6 @@ Bug #22207 (missing 0 when using the e notation in *printf functions)
var_dump(sprintf("%10.5e\n", 1.1));
?>
--EXPECT--
-1.1000e+0
-string(11) " 1.1000e+0
+1.10000e+0
+string(11) "1.10000e+0
"
diff --git a/ext/standard/tests/strings/bug26819.phpt b/ext/standard/tests/strings/bug26819.phpt
index 4a5353943..2d639a932 100644
--- a/ext/standard/tests/strings/bug26819.phpt
+++ b/ext/standard/tests/strings/bug26819.phpt
@@ -6,4 +6,4 @@ $a = array();
var_dump(http_build_query($a));
?>
--EXPECT--
-NULL
+string(0) ""
diff --git a/ext/standard/tests/strings/bug36392.phpt b/ext/standard/tests/strings/bug36392.phpt
new file mode 100644
index 000000000..8e4cd16c6
--- /dev/null
+++ b/ext/standard/tests/strings/bug36392.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #36392 (wrong number of decimal digits with %e specifier in sprintf)
+--FILE--
+<?php
+ echo sprintf("%e\n", 1.123456789);
+ echo sprintf("%.10e\n", 1.123456789);
+ echo sprintf("%.0e\n", 1.123456789);
+ echo sprintf("%.1e\n", 1.123456789);
+ echo sprintf("%5.1e\n", 1.123456789);
+?>
+--EXPECT--
+1.123457e+0
+1.1234567890e+0
+1e+0
+1.1e+0
+1.1e+0
diff --git a/ext/standard/tests/strings/bug38770.phpt b/ext/standard/tests/strings/bug38770.phpt
new file mode 100644
index 000000000..2494a911b
--- /dev/null
+++ b/ext/standard/tests/strings/bug38770.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #38770 (unpack() broken with longs on 64 bit machines)
+--FILE--
+<?php
+
+foreach (array('N','I','l') as $v) {
+ print_r(unpack($v, pack($v, -30000)));
+}
+
+echo "Done\n";
+?>
+--EXPECT--
+Array
+(
+ [1] => -30000
+)
+Array
+(
+ [1] => -30000
+)
+Array
+(
+ [1] => -30000
+)
+Done
diff --git a/ext/standard/tests/strings/bug39350.phpt b/ext/standard/tests/strings/bug39350.phpt
new file mode 100644
index 000000000..53d58b709
--- /dev/null
+++ b/ext/standard/tests/strings/bug39350.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #39350 (implode/join() crash on empty input strings)
+--FILE--
+<?php
+
+implode('', array(null));
+implode('', array(false));
+implode('', array(""));
+
+echo "Done\n";
+?>
+--EXPECT--
+Done
diff --git a/ext/standard/tests/strings/bug39621.phpt b/ext/standard/tests/strings/bug39621.phpt
new file mode 100644
index 000000000..1a33147b6
--- /dev/null
+++ b/ext/standard/tests/strings/bug39621.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/bug39873.phpt b/ext/standard/tests/strings/bug39873.phpt
new file mode 100644
index 000000000..e73f3c851
--- /dev/null
+++ b/ext/standard/tests/strings/bug39873.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #39873 (number_format() breaks with locale & decimal points)
+--SKIPIF--
+<?php
+if (!setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO_8859-1")) {
+ die("skip locale needed for this test is not supported on this platform");
+}
+?>
+--FILE--
+<?php
+ setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO_8859-1");
+ $num = 0+"1234.56";
+ echo number_format($num,2);
+ echo "\n";
+?>
+--EXPECT--
+1,234.56
diff --git a/ext/standard/tests/strings/bug40432.phpt b/ext/standard/tests/strings/bug40432.phpt
new file mode 100644
index 000000000..6db2e94e5
--- /dev/null
+++ b/ext/standard/tests/strings/bug40432.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #40432 (strip_tags() fails with greater than in attribute)
+--FILE--
+<?php
+echo strip_tags('<span title="test > all">this</span>') . "\n";
+?>
+--EXPECT--
+this
diff --git a/ext/standard/tests/strings/bug40637.phpt b/ext/standard/tests/strings/bug40637.phpt
new file mode 100644
index 000000000..5669083aa
--- /dev/null
+++ b/ext/standard/tests/strings/bug40637.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #40637 (strip_tags() does not handle single quotes correctly)
+--FILE--
+<?php
+
+$html = '<span title="Bug \' Trigger">Text</span>';
+var_dump(strip_tags($html));
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(4) "Text"
+Done
diff --git a/ext/standard/tests/strings/bug40704.phpt b/ext/standard/tests/strings/bug40704.phpt
new file mode 100644
index 000000000..82e91b5c8
--- /dev/null
+++ b/ext/standard/tests/strings/bug40704.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #40704 (strip_tags() does not handle single quotes correctly)
+--FILE--
+<?php
+
+$html = "<div>Bug ' Trigger</div> Missing Text";
+var_dump(strip_tags($html));
+
+echo "Done\n";
+?>
+--EXPECT--
+string(26) "Bug ' Trigger Missing Text"
+Done
diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt
new file mode 100644
index 000000000..23a459317
--- /dev/null
+++ b/ext/standard/tests/strings/bug40754.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Bug #40754 (Overflow checks inside string functions)
+--FILE--
+<?php
+
+$v = 2147483647;
+
+var_dump(substr("abcde", 1, $v));
+var_dump(substr_replace("abcde", "x", $v, $v));
+
+var_dump(strspn("abcde", "abc", $v, $v));
+var_dump(strcspn("abcde", "abc", $v, $v));
+
+var_dump(substr_count("abcde", "abc", $v, $v));
+var_dump(substr_compare("abcde", "abc", $v, $v));
+
+var_dump(stripos("abcde", "abc", $v));
+var_dump(substr_count("abcde", "abc", $v, 1));
+var_dump(substr_count("abcde", "abc", 1, $v));
+var_dump(strpos("abcde", "abc", $v));
+var_dump(stripos("abcde", "abc", $v));
+var_dump(strrpos("abcde", "abc", $v));
+var_dump(strripos("abcde", "abc", $v));
+var_dump(strncmp("abcde", "abc", $v));
+var_dump(chunk_split("abcde", $v, "abc"));
+var_dump(substr("abcde", $v, $v));
+
+?>
+--EXPECTF--
+string(4) "bcde"
+bool(false)
+bool(false)
+bool(false)
+
+Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s on line %d
+bool(false)
+
+Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
+bool(false)
+
+Warning: stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s on line %d
+bool(false)
+
+Warning: substr_count(): Length value 2147483647 exceeds string length. in %s on line %d
+bool(false)
+
+Warning: strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+Warning: stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+int(2)
+string(8) "abcdeabc"
+bool(false)
diff --git a/ext/standard/tests/strings/bug40915.phpt b/ext/standard/tests/strings/bug40915.phpt
new file mode 100644
index 000000000..9b26896e7
--- /dev/null
+++ b/ext/standard/tests/strings/bug40915.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt
new file mode 100644
index 000000000..a6f365731
--- /dev/null
+++ b/ext/standard/tests/strings/convert_cyr_string.phpt
@@ -0,0 +1,54 @@
+--TEST--
+basic convert_cyr_string() tests
+--FILE--
+<?php
+
+var_dump(convert_cyr_string());
+var_dump(convert_cyr_string(""));
+var_dump(convert_cyr_string("", ""));
+var_dump(convert_cyr_string("", "", ""));
+var_dump(convert_cyr_string(array(), array(), array()));
+
+var_dump(convert_cyr_string("[[[[[[", "q", "m"));
+var_dump(convert_cyr_string("[[[[[[", "k", "w"));
+var_dump(convert_cyr_string("[[[[[[", "m", "a"));
+var_dump(convert_cyr_string("[[[[[[", "d", "i"));
+var_dump(convert_cyr_string("[[[[[[", "w", "k"));
+var_dump(convert_cyr_string("[[[[[[", "i", "q"));
+var_dump(convert_cyr_string("", "d", "i"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+Warning: convert_cyr_string(): Unknown source charset: in %s on line %d
+
+Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d
+string(0) ""
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+
+Warning: convert_cyr_string(): Unknown destination charset: q in %s on line %d
+string(6) "[[[[[["
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt
index 5368178e1..ce178f684 100644
--- a/ext/standard/tests/strings/crypt.phpt
+++ b/ext/standard/tests/strings/crypt.phpt
@@ -24,9 +24,20 @@ echo (CRYPT_EXT_DES) ? ((crypt($str, $salt2) === $res_2) ? 'EXT' : 'EXT - ERROR
echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR') : 'MD5', "\n";
echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n";
+var_dump(crypt($str));
+var_dump(crypt());
+var_dump(crypt("", "", ""));
+
?>
---EXPECT--
+--EXPECTF--
STD
EXT
MD5
BLO
+string(%d) "%s"
+
+Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/strings/get_meta_tags.phpt b/ext/standard/tests/strings/get_meta_tags.phpt
new file mode 100644
index 000000000..f086b99b7
--- /dev/null
+++ b/ext/standard/tests/strings/get_meta_tags.phpt
@@ -0,0 +1,95 @@
+--TEST--
+get_meta_tags() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/get_meta_tags.html";
+
+$data = <<<DATA
+<meta name="author" content="name">
+<meta name="keywords" content="php documentation">
+<meta name="DESCRIPTION" content="a php manual">
+<meta name="geo.position" content="49.33;-86.59">
+</head> <!-- parsing stops here -->
+DATA;
+
+$data1 = <<<DATA
+<html>
+ <head>
+ <meta name="author" content="name">
+ <meta name="keywords" content="php documentation">
+ <meta name="DESCRIPTION" content="a php manual">
+ <meta name="geo.position" content="49.33;-86.59">
+ </head>
+ <body>
+ <meta name="author" content="name1">
+ <meta name="keywords" content="php documentation1">
+ <meta name="DESCRIPTION" content="a php manual1">
+ <meta name="geo.position" content="49.33;-86.591">
+ </body>
+</html>
+DATA;
+
+$data2 = <<<DATA
+<meta name="author" content="name"
+<meta name="keywords" content="php documentation">
+DATA;
+
+$data3 = <<<DATA
+<meta <meta name="keywords" content="php documentation">
+DATA;
+
+$data4 = <<<DATA
+<meta name="author" content="name"
+<meta name="keywords" content="php documentation"
+DATA;
+
+$array = array($data, $data1, $data2, $data3, $data4, "", "<>", "<meta<<<<<");
+
+foreach ($array as $html) {
+ file_put_contents($filename, $html);
+ var_dump(get_meta_tags($filename));
+}
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(4) {
+ ["author"]=>
+ string(4) "name"
+ ["keywords"]=>
+ string(17) "php documentation"
+ ["description"]=>
+ string(12) "a php manual"
+ ["geo_position"]=>
+ string(12) "49.33;-86.59"
+}
+array(4) {
+ ["author"]=>
+ string(4) "name"
+ ["keywords"]=>
+ string(17) "php documentation"
+ ["description"]=>
+ string(12) "a php manual"
+ ["geo_position"]=>
+ string(12) "49.33;-86.59"
+}
+array(1) {
+ ["keywords"]=>
+ string(17) "php documentation"
+}
+array(1) {
+ ["keywords"]=>
+ string(17) "php documentation"
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt
new file mode 100644
index 000000000..2c83ee299
--- /dev/null
+++ b/ext/standard/tests/strings/highlight_file.phpt
@@ -0,0 +1,68 @@
+--TEST--
+highlight_file() tests
+--INI--
+highlight.string=#DD0000
+highlight.comment=#FF9900
+highlight.keyword=#007700
+highlight.bg=#FFFFFF
+highlight.default=#0000BB
+highlight.html=#000000
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/highlight_file.dat";
+
+var_dump(highlight_file());
+var_dump(highlight_file($filename));
+
+$data = <<<DATA
+<?php echo "test"; ?>
+DATA;
+
+file_put_contents($filename, $data);
+var_dump(highlight_file($filename));
+
+$data = <<<DATA
+<?php echo "test ?>
+DATA;
+
+file_put_contents($filename, $data);
+var_dump(highlight_file($filename));
+
+$data = '
+<?php
+ class test {
+ public $var = 1;
+ private function foo() { echo "foo"; }
+ public function bar() { var_dump(test::foo()); }
+ }
+?>';
+
+file_put_contents($filename, $data);
+var_dump(highlight_file($filename));
+
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d
+
+Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
+bool(false)
+<code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test"</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">?&gt;</span>
+</span>
+</code>bool(true)
+<code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test&nbsp;?&gt;</span>
+</span>
+</code>bool(true)
+<code><span style="color: #000000">
+<br /><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;</span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;</span><span style="color: #0000BB">$var&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">()&nbsp;{&nbsp;echo&nbsp;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">bar</span><span style="color: #007700">()&nbsp;{&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">test</span><span style="color: #007700">::</span><span style="color: #0000BB">foo</span><span style="color: #007700">());&nbsp;}<br />&nbsp;}&nbsp;&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span>
+</span>
+</code>bool(true)
+Done
diff --git a/ext/standard/tests/strings/htmlentities02.phpt b/ext/standard/tests/strings/htmlentities02.phpt
index 666c4f650..babec44b5 100644
--- a/ext/standard/tests/strings/htmlentities02.phpt
+++ b/ext/standard/tests/strings/htmlentities02.phpt
@@ -2,8 +2,8 @@
htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15)
--SKIPIF--
<?php
-$result = (bool)setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15");
-if (!$result || preg_match('/ISO/i', setlocale(LC_CTYPE, 0)) == 0) {
+$result = (bool)setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15", 'fr_FR@euro');
+if (!$result) {
die("skip setlocale() failed\n");
}
echo "warn possibly braindead libc\n";
@@ -14,7 +14,7 @@ default_charset=
mbstring.internal_encoding=none
--FILE--
<?php
- setlocale( LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15" );
+ setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15", 'fr_FR@euro');
var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt
new file mode 100644
index 000000000..d7d5e7a44
--- /dev/null
+++ b/ext/standard/tests/strings/levenshtein.phpt
@@ -0,0 +1,88 @@
+--TEST--
+levenshtein() function test
+--FILE--
+<?php
+
+function test_me($title,$expect,$text1,$text2,$cost1="",$cost2="",$cost3="") {
+
+ if ($cost1=="") {
+ $result=levenshtein($text1,$text2);
+ }
+ elseif ($cost2=="") {
+ $result=levenshtein($text1,$text2,$cost1);
+ }
+ else {
+ $result=levenshtein($text1,$text2,$cost1,$cost2,$cost3);
+ }
+ if($result==$expect) return 0;
+
+ echo "$title: result is $result instead of $expect ";
+ echo "for '$text1'/'$text2' ";
+ if($cost1) echo "($cost1:$cost2:$cost3)";
+ echo "\n";
+
+ return 1;
+}
+
+$n=0;
+
+$n += test_me("equal" , 0, "12345", "12345");
+$n += test_me("1st empty" , 3, "", "xzy");
+$n += test_me("2nd empty" , 3, "xzy", "");
+$n += test_me("both empty" , 0, "", "");
+$n += test_me("1 char" , 1, "1", "2");
+$n += test_me("2 char swap", 2, "12", "21");
+
+$n += test_me("inexpensive delete", 2, "2121", "11", 2, 1, 1);
+$n += test_me("expensive delete" , 10, "2121", "11", 2, 1, 5);
+$n += test_me("inexpensive insert", 2, "11", "2121", 1, 1, 1);
+$n += test_me("expensive insert" , 10, "11", "2121", 5, 1, 1);
+
+$n += test_me("expensive replace" , 3, "111", "121", 2, 3, 2);
+$n += test_me("very expensive replace", 4, "111", "121", 2, 9, 2);
+
+$n += test_me("bug #7368", 2, "13458", "12345");
+$n += test_me("bug #7368", 2, "1345", "1234");
+
+$n += test_me("bug #6562", 1, "debugg", "debug");
+$n += test_me("bug #6562", 1, "ddebug", "debug");
+$n += test_me("bug #6562", 2, "debbbug", "debug");
+$n += test_me("bug #6562", 1, "debugging", "debuging");
+
+$n += test_me("bug #16473", 2, "a", "bc");
+$n += test_me("bug #16473", 2, "xa", "xbc");
+$n += test_me("bug #16473", 2, "xax", "xbcx");
+$n += test_me("bug #16473", 2, "ax", "bcx");
+
+$n += test_me("custom", -1, "111", "121", "my_levcode");
+$n += test_me("lt maxlength1", 254, "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsu", "A");
+$n += test_me("gt maxlength1", -1, "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuv", "A");
+
+$n += test_me("lt maxlength2", 254, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsu");
+$n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuv");
+
+echo ($n==0)?"all passed\n":"$n failed\n";
+
+var_dump(levenshtein(array(), array()));
+var_dump(levenshtein("", "", -1, -1, -1));
+var_dump(levenshtein("", "", 10, 10, 10));
+var_dump(levenshtein(""));
+
+?>
+--EXPECTF--
+Warning: levenshtein(): The general Levenshtein support is not there yet in %s on line %d
+
+Warning: levenshtein(): Argument string(s) too long in %s on line %d
+
+Warning: levenshtein(): Argument string(s) too long in %s on line %d
+all passed
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+int(0)
+int(0)
+
+Warning: Wrong parameter count for levenshtein() in %s on line %d
+NULL
diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt
new file mode 100644
index 000000000..cb64b9cd3
--- /dev/null
+++ b/ext/standard/tests/strings/ltrim.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test ltrim() function
+--FILE--
+<?php
+
+/* Testing for Error conditions */
+
+/* Invalid Number of Arguments */
+
+ echo "\n *** Output for Error Conditions ***\n";
+
+ echo "\n *** Output for zero argument ***\n";
+ var_dump( ltrim() );
+
+ echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n";
+ var_dump( ltrim("", " ", 1) );
+
+/* heredoc string */
+$str = <<<EOD
+us
+ing heredoc string
+EOD;
+
+echo "\n *** Using heredoc string ***\n";
+var_dump( ltrim($str, "\nusi") );
+
+/* Testing the Normal behaviour of ltrim() function */
+
+ echo "\n *** Output for Normal Behaviour ***\n";
+ var_dump ( ltrim(" \t\0 ltrim test") ); /* without second Argument */
+ var_dump ( ltrim(" ltrim test" , "") ); /* no characters in second Argument */
+ var_dump ( ltrim(" ltrim test", NULL) ); /* with NULL as second Argument */
+ var_dump ( ltrim(" ltrim test", true) ); /* with boolean value as second Argument */
+ var_dump ( ltrim(" ltrim test", " ") ); /* with single space as second Argument */
+ var_dump ( ltrim("\t\n\r\0\x0B ltrim test", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
+ var_dump ( ltrim("ABCXYZltrim test", "A..Z") ); /* with characters range as second Argument */
+ var_dump ( ltrim("0123456789ltrim test", "0..9") ); /* with numbers range as second Argument */
+ var_dump ( ltrim("@$#ltrim test", "#@$") ); /* with some special characters as second Argument */
+
+
+ echo "\n *** Output for scalar argument) ***\n";
+ var_dump( ltrim( 12345 ) ); /* Scalar argument */
+
+ echo "\n *** Output for NULL argument) ***\n";
+ var_dump( ltrim(NULL) ); /* NULL Argument */
+
+echo "\nDone\n";
+
+?>
+--EXPECTF--
+*** Output for Error Conditions ***
+
+ *** Output for zero argument ***
+
+Warning: Wrong parameter count for ltrim() in %s on line %d
+NULL
+
+ *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***
+
+Warning: Wrong parameter count for ltrim() in %s on line %d
+NULL
+
+ *** Using heredoc string ***
+string(17) "ng heredoc string"
+
+ *** Output for Normal Behaviour ***
+string(10) "ltrim test"
+string(13) " ltrim test"
+string(18) " ltrim test"
+string(18) " ltrim test"
+string(10) "ltrim test"
+string(11) " ltrim test"
+string(10) "ltrim test"
+string(10) "ltrim test"
+string(10) "ltrim test"
+
+ *** Output for scalar argument) ***
+string(5) "12345"
+
+ *** Output for NULL argument) ***
+string(0) ""
+
+Done
diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt
new file mode 100644
index 000000000..d1aa9af54
--- /dev/null
+++ b/ext/standard/tests/strings/metaphone.phpt
@@ -0,0 +1,41 @@
+--TEST--
+metaphone() tests
+--FILE--
+<?php
+
+var_dump(metaphone());
+var_dump(metaphone(""));
+var_dump(metaphone(-1));
+var_dump(metaphone(-1, -1));
+
+var_dump(metaphone("valid phrase", -1));
+var_dump(metaphone("valid phrase", 0));
+var_dump(metaphone("valid phrase", 10000));
+
+$array = array(
+"They fell forward, grovelling heedlessly on the cold earth.",
+"But the shadow of horror wheeled and returned, passing lower now, right above them, sweeping the fen-reek with its ghastly wings.",
+"And then it was gone, flying back to Mordor with the speed of the wrath of Sauron; and behind it the wind roared away, leaving the Dead Marshes bare and bleak.",
+"The naked waste, as far as the eye could pierce, even to the distant menace of the mountains, was dappled with the fitful moonlight."
+);
+
+foreach($array as $str) {
+ var_dump(metaphone($str));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+string(0) ""
+string(0) ""
+bool(false)
+bool(false)
+string(6) "FLTFRS"
+string(6) "FLTFRS"
+string(26) "0FLFRWRTKRFLNKHTLSLN0KLTR0"
+string(56) "BT0XTFHRRHLTNTRTRNTPSNKLWRNRFTBF0MSWPNK0FNRKW0TSFSTLWNKS"
+string(69) "ANT0NTWSKNFLYNKBKTMRTRW00SPTF0R0FSRNNTBHNTT0WNTRRTWLFNK0TTMRXSBRNTBLK"
+string(56) "0NKTWSTSFRS0YKLTPRSFNT0TSTNTMNSF0MNTNSWSTPLTW00FTFLMNLFT"
+Done
diff --git a/ext/standard/tests/strings/pack.phpt b/ext/standard/tests/strings/pack.phpt
new file mode 100644
index 000000000..b36eee1e5
--- /dev/null
+++ b/ext/standard/tests/strings/pack.phpt
@@ -0,0 +1,385 @@
+--TEST--
+Generic pack()/unpack() tests
+--SKIPIF--
+<?php
+if (PHP_INT_MAX > 2147483647) {
+ die("skip 32bit test only");
+}
+?>
+--FILE--
+<?php
+print_r(unpack("A", pack("A", "hello world")));
+print_r(unpack("A*", pack("A*", "hello world")));
+echo '"'.pack("A9", "hello").'"';
+echo "\n";
+
+print_r(unpack("C", pack("C", -127)));
+print_r(unpack("C", pack("C", 127)));
+print_r(unpack("C", pack("C", 255)));
+print_r(unpack("C", pack("C", -129)));
+
+print_r(unpack("H", pack("H", 0x04)));
+
+print_r(unpack("I", pack("I", 65534)));
+print_r(unpack("I", pack("I", 0)));
+print_r(unpack("I", pack("I", -1000)));
+print_r(unpack("I", pack("I", -64434)));
+print_r(unpack("I", pack("I", 4294967296)));
+print_r(unpack("I", pack("I", -4294967296)));
+
+print_r(unpack("L", pack("L", 65534)));
+print_r(unpack("L", pack("L", 0)));
+print_r(unpack("L", pack("L", 2147483650)));
+print_r(unpack("L", pack("L", 4294967295)));
+print_r(unpack("L", pack("L", -2147483648)));
+
+print_r(unpack("N", pack("N", 65534)));
+print_r(unpack("N", pack("N", 0)));
+print_r(unpack("N", pack("N", 2147483650)));
+print_r(unpack("N", pack("N", 4294967296)));
+print_r(unpack("N", pack("N", -2147483648)));
+print_r(unpack("N", pack("N", -30000)));
+
+print_r(unpack("S", pack("S", 65534)));
+print_r(unpack("S", pack("S", 65537)));
+print_r(unpack("S", pack("S", 0)));
+print_r(unpack("S", pack("S", -1000)));
+print_r(unpack("S", pack("S", -64434)));
+print_r(unpack("S", pack("S", -65535)));
+
+print_r(unpack("V", pack("V", 65534)));
+print_r(unpack("V", pack("V", 0)));
+print_r(unpack("V", pack("V", 2147483650)));
+print_r(unpack("V", pack("V", 4294967296)));
+print_r(unpack("V", pack("V", -2147483648)));
+
+print_r(unpack("a", pack("a", "hello world")));
+print_r(unpack("a*", pack("a*", "hello world")));
+
+print_r(unpack("c", pack("c", -127)));
+print_r(unpack("c", pack("c", 127)));
+print_r(unpack("c", pack("c", 255)));
+print_r(unpack("c", pack("c", -129)));
+
+print_r(unpack("h", pack("h", 3000000)));
+
+print_r(unpack("i", pack("i", 65534)));
+print_r(unpack("i", pack("i", 0)));
+print_r(unpack("i", pack("i", -1000)));
+print_r(unpack("i", pack("i", -64434)));
+print_r(unpack("i", pack("i", -65535)));
+print_r(unpack("i", pack("i", -2147483647)));
+
+print_r(unpack("l", pack("l", 65534)));
+print_r(unpack("l", pack("l", 0)));
+print_r(unpack("l", pack("l", 2147483650)));
+print_r(unpack("l", pack("l", 4294967296)));
+print_r(unpack("l", pack("l", -2147483648)));
+
+print_r(unpack("n", pack("n", 65534)));
+print_r(unpack("n", pack("n", 65537)));
+print_r(unpack("n", pack("n", 0)));
+print_r(unpack("n", pack("n", -1000)));
+print_r(unpack("n", pack("n", -64434)));
+print_r(unpack("n", pack("n", -65535)));
+
+print_r(unpack("s", pack("s", 32767)));
+print_r(unpack("s", pack("s", 65535)));
+print_r(unpack("s", pack("s", 0)));
+print_r(unpack("s", pack("s", -1000)));
+print_r(unpack("s", pack("s", -64434)));
+print_r(unpack("s", pack("s", -65535)));
+
+print_r(unpack("v", pack("v", 65534)));
+print_r(unpack("v", pack("v", 65537)));
+print_r(unpack("v", pack("v", 0)));
+print_r(unpack("v", pack("v", -1000)));
+print_r(unpack("v", pack("v", -64434)));
+print_r(unpack("v", pack("v", -65535)));
+?>
+--EXPECT--
+Array
+(
+ [1] => h
+)
+Array
+(
+ [1] => hello world
+)
+"hello "
+Array
+(
+ [1] => 129
+)
+Array
+(
+ [1] => 127
+)
+Array
+(
+ [1] => 255
+)
+Array
+(
+ [1] => 127
+)
+Array
+(
+ [1] => 4
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -1000
+)
+Array
+(
+ [1] => -64434
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483646
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483646
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => -30000
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => 64536
+)
+Array
+(
+ [1] => 1102
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483646
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => h
+)
+Array
+(
+ [1] => hello world
+)
+Array
+(
+ [1] => -127
+)
+Array
+(
+ [1] => 127
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => 127
+)
+Array
+(
+ [1] => 3
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -1000
+)
+Array
+(
+ [1] => -64434
+)
+Array
+(
+ [1] => -65535
+)
+Array
+(
+ [1] => -2147483647
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483646
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => 64536
+)
+Array
+(
+ [1] => 1102
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 32767
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -1000
+)
+Array
+(
+ [1] => 1102
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => 64536
+)
+Array
+(
+ [1] => 1102
+)
+Array
+(
+ [1] => 1
+)
diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt
index c1d58f05b..d9c3a2ed6 100644
--- a/ext/standard/tests/strings/pathinfo.phpt
+++ b/ext/standard/tests/strings/pathinfo.phpt
@@ -57,7 +57,7 @@ array(4) {
}
array(3) {
["dirname"]=>
- string(1) "/"
+ string(1) "%e"
["basename"]=>
string(0) ""
["filename"]=>
@@ -75,7 +75,7 @@ array(4) {
}
array(4) {
["dirname"]=>
- string(1) "/"
+ string(1) "%e"
["basename"]=>
string(1) "."
["extension"]=>
@@ -96,13 +96,13 @@ array(4) {
string(12) "pathinfo.php"
string(8) "pathinfo"
string(3) "php"
-string(%d) "%s/strings"
-string(%d) "%s/strings"
+string(%d) "%s%estrings"
+string(%d) "%s%estrings"
string(12) "pathinfo.php"
string(3) "php"
string(12) "pathinfo.php"
-string(%d) "%s/strings"
+string(%d) "%s%estrings"
string(12) "pathinfo.php"
-string(%d) "%s/strings"
-string(%d) "%s/strings"
+string(%d) "%s%estrings"
+string(%d) "%s%estrings"
Done
diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt
new file mode 100644
index 000000000..4f7ef909e
--- /dev/null
+++ b/ext/standard/tests/strings/php_strip_whitespace.phpt
@@ -0,0 +1,52 @@
+--TEST--
+php_strip_whitespace() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/php_strip_whitespace.dat";
+
+var_dump(php_strip_whitespace());
+var_dump(php_strip_whitespace($filename));
+
+$data = '/* test comment */';
+file_put_contents($filename, $data);
+var_dump(php_strip_whitespace($filename));
+
+$data = '<?php /* test comment */ ?>';
+file_put_contents($filename, $data);
+var_dump(php_strip_whitespace($filename));
+
+$data = '<?php
+/* test class */
+class test {
+
+ /* function foo () */
+
+ function foo () /* {{{ */
+ {
+
+
+ echo $var; //does not exist
+ }
+ /* }}} */
+
+}
+?>';
+
+file_put_contents($filename, $data);
+var_dump(php_strip_whitespace($filename));
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d
+string(0) ""
+string(18) "/* test comment */"
+string(9) "<?php ?>"
+string(55) "<?php
+ class test { function foo () { echo $var; } } ?>"
+Done
diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt
new file mode 100755
index 000000000..13a8ed071
--- /dev/null
+++ b/ext/standard/tests/strings/printf.phpt
@@ -0,0 +1,697 @@
+--TEST--
+Test printf() function (32bit)
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_MAX > 2147483647) {
+ die("skip 32bit test only");
+}
+?>
+--FILE--
+<?php
+
+/* Various input arrays for different format types */
+
+$float_variation = array( "%f", "%-f", "%+f", "%7.2f", "%-7.2f", "%07.2f", "%-07.2f", "%'#7.2f" );
+$float_numbers = array( 0, 1, -1, 0.32, -0.32, 3.4. -3.4, 2.54, -2.54, 1.2345678e99, -1.2345678e99 );
+
+$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+$char_variation = array( 'a', "a", 67, -67, 99 );
+
+$string_variation = array( "%5s", "%-5s", "%05s", "%'#5s" );
+$strings = array( NULL, "abc", 'aaa' );
+
+/* Checking warning messages */
+
+/* Zero argument */
+echo "\n*** Output for zero argument ***\n";
+printf();
+
+/* Number of arguments not matching as specified in format field */
+echo "\n*** Output for insufficient number of arguments ***\n";
+$string = "dingy%sflem%dwombat";
+$nbr = 5;
+$name = "voudras";
+printf("%d $string %s", $nbr, $name);
+
+
+/* Scalar argument */
+echo "\n*** Output for scalar argument ***\n";
+printf(3);
+
+/* NULL argument */
+echo "\n*** Output for NULL as argument ***\n";
+printf(NULL);
+
+
+/* Float type variations */
+
+$counter = 1;
+echo "\n\n*** Output for float type ***\n";
+echo "\n Input Float numbers variation array is:\n";
+print_r($float_numbers);
+
+foreach( $float_variation as $float_var )
+{
+ echo "\n\nFloat Iteration $counter";
+ foreach( $float_numbers as $float_num )
+ {
+ echo "\n";
+ printf( $float_var, $float_num );
+ }
+ $counter++;
+}
+
+
+/* Integer type variations */
+
+$counter = 1;
+echo "\n\n*** Output for integer type ***\n";
+echo "\n Input Integer numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_variation as $int_var )
+{
+ echo "\n\nInteger Iteration $counter";
+ foreach( $int_numbers as $int_num )
+ {
+ echo "\n";
+ printf( $int_var, $int_num );
+ }
+ $counter++;
+}
+
+
+/* Binary type variations */
+
+echo "\n\n*** Output for binary type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+ foreach( $int_numbers as $bin_num )
+ {
+ echo "\n";
+ printf( "%b", $bin_num );
+ }
+
+
+/* Chararter type variations */
+echo "\n\n*** Output for char type ***\n";
+echo "\n Input Characters variation array is:\n";
+print_r($char_variation);
+
+foreach( $char_variation as $char )
+{
+ echo "\n";
+ printf( "%c", $char );
+}
+
+/* Scientific type variations */
+echo "\n\n*** Output for scientific type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $num )
+{
+ echo "\n";
+ printf( "%e", $num );
+}
+
+/* Unsigned Integer type variation */
+echo "\n\n*** Output for unsigned integer type ***\n";
+echo "\n Input Integer numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $unsig_num )
+{
+ echo "\n";
+ printf( "%u", $unsig_num );
+}
+
+/* Octal type variations */
+echo "\n\n*** Output for octal type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $octal_num )
+{
+ echo "\n";
+ printf( "%o", $octal_num );
+}
+
+/* Hexadecimal type variations */
+echo "\n\n*** Output for hexadecimal type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $hexa_num )
+{
+ echo "\n";
+ printf( "%x", $hexa_num );
+}
+
+/* String type variations */
+echo "\n\n*** Output for string type ***\n";
+echo "\n Input Strings format variation array is:\n";
+print_r($string_variation);
+echo "\n Input strings variation array is:\n";
+print_r($strings);
+
+foreach( $string_variation as $string_var )
+{
+ foreach( $strings as $str )
+ {
+ echo "\n";
+ printf( $string_var, $str );
+ }
+}
+
+
+/* variations of %g type */
+$format_g = array("%g", "%.0g", "%+g", "%-g", "%-1.2g", "%+1.2g", "%G", "%.0G", "%+G", "%-G", "%-1.2G", "%+1.2G");
+
+echo "\n\n*** Output for '%g' type ***\n";
+echo "\n Input format variation array is:\n";
+print_r($format_g);
+
+foreach( $format_g as $formatg )
+{
+ printf("\n$formatg",123456);
+ printf("\n$formatg",-123456);
+}
+
+
+/* Some more typical cases */
+
+$tempnum = 12345;
+$tempstring = "abcdefghjklmnpqrstuvwxyz";
+
+echo"\n\n*** Output for '%%%.2f' as the format parameter ***\n";
+printf("%%%.2f",1.23456789e10);
+
+echo"\n\n*** Output for '%%' as the format parameter ***\n";
+printf("%%",1.23456789e10);
+
+echo"\n\n*** Output for precision value more than maximum ***\n";
+printf("%.988f",1.23456789e10);
+
+echo"\n\n*** Output for invalid width(-15) specifier ***\n";
+printf("%030.-15s", $tempstring);
+
+echo"\n\n*** Output for '%F' as the format parameter ***\n";
+printf("%F",1.23456789e10);
+
+echo"\n\n*** Output for '%X' as the format parameter ***\n";
+printf("%X",12);
+
+echo"\n\n*** Output with no format parameter ***\n";
+printf($tempnum);
+
+echo"\n\n*** Output for multiple format parameters ***\n";
+printf("%d %s %d\n", $tempnum, $tempstring, $tempnum);
+
+echo"\n\n*** Output for excess of mixed type arguments ***\n";
+printf("%s", $tempstring, $tempstring, $tempstring);
+
+echo"\n\n*** Output for string format parameter and integer type argument ***\n";
+printf("%s", $tempnum);
+
+echo"\n\n*** Output for integer format parameter and string type argument ***\n";
+printf("%d", $tempstring);
+
+
+?>
+--EXPECTF--
+*** Output for zero argument ***
+
+Warning: Wrong parameter count for printf() in %s on line %d
+
+*** Output for insufficient number of arguments ***
+
+Warning: printf(): Too few arguments in %s on line %d
+
+*** Output for scalar argument ***
+3
+*** Output for NULL as argument ***
+
+
+*** Output for float type ***
+
+ Input Float numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 0.32
+ [4] => -0.32
+ [5] => 3.4-3.4
+ [6] => 2.54
+ [7] => -2.54
+ [8] => 1.2345678E+99
+ [9] => -1.2345678E+99
+)
+
+
+Float Iteration 1
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+1234567%d.000000
+-1234567%d.000000
+
+Float Iteration 2
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+1234567%d.000000
+-1234567%d.000000
+
+Float Iteration 3
++0.000000
++1.000000
+-1.000000
++0.320000
+-0.320000
++3.400000
++2.540000
+-2.540000
++1234567%d.000000
+-1234567%d.000000
+
+Float Iteration 4
+ 0.00
+ 1.00
+ -1.00
+ 0.32
+ -0.32
+ 3.40
+ 2.54
+ -2.54
+1234567%d.00
+-1234567%d.00
+
+Float Iteration 5
+0.00
+1.00
+-1.00
+0.32
+-0.32
+3.40
+2.54
+-2.54
+1234567%d.00
+-1234567%d.00
+
+Float Iteration 6
+0000.00
+0001.00
+-001.00
+0000.32
+-000.32
+0003.40
+0002.54
+-002.54
+1234567%d.00
+-1234567%d.00
+
+Float Iteration 7
+0.00000
+1.00000
+-1.0000
+0.32000
+-0.3200
+3.40000
+2.54000
+-2.5400
+1234567%d.00
+-1234567%d.00
+
+Float Iteration 8
+###0.00
+###1.00
+##-1.00
+###0.32
+##-0.32
+###3.40
+###2.54
+##-2.54
+1234567%d.00
+-1234567%d.00
+
+*** Output for integer type ***
+
+ Input Integer numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+
+Integer Iteration 1
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 2
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 3
++0
++1
+-1
++2
+-2
++23333333
+-23333333
++1234
+
+Integer Iteration 4
+ 0
+ 1
+ -1
+ 2
+ -2
+23333333
+-23333333
+ 1234
+
+Integer Iteration 5
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 6
+0000000
+0000001
+-000001
+0000002
+-000002
+23333333
+-23333333
+0001234
+
+Integer Iteration 7
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 8
+######0
+######1
+#####-1
+######2
+#####-2
+23333333
+-23333333
+###1234
+
+*** Output for binary type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+11111111111111111111111111111111
+10
+11111111111111111111111111111110
+1011001000000100111010101
+11111110100110111111011000101011
+10011010010
+
+*** Output for char type ***
+
+ Input Characters variation array is:
+Array
+(
+ [0] => a
+ [1] => a
+ [2] => 67
+ [3] => -67
+ [4] => 99
+)
+
+
+
+C
+c
+
+*** Output for scientific type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0.000000e+0
+1.000000e+0
+-1.000000e+0
+2.700000e+0
+-2.700000e+0
+2.333333e+7
+-2.333333e+7
+1.234000e+3
+
+*** Output for unsigned integer type ***
+
+ Input Integer numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+4294967295
+2
+4294967294
+23333333
+4271633963
+1234
+
+*** Output for octal type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+37777777777
+2
+37777777776
+131004725
+37646773053
+2322
+
+*** Output for hexadecimal type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+ffffffff
+2
+fffffffe
+16409d5
+fe9bf62b
+4d2
+
+*** Output for string type ***
+
+ Input Strings format variation array is:
+Array
+(
+ [0] => %5s
+ [1] => %-5s
+ [2] => %05s
+ [3] => %'#5s
+)
+
+ Input strings variation array is:
+Array
+(
+ [0] =>
+ [1] => abc
+ [2] => aaa
+)
+
+
+ abc
+ aaa
+
+abc
+aaa
+00000
+00abc
+00aaa
+#####
+##abc
+##aaa
+
+*** Output for '%g' type ***
+
+ Input format variation array is:
+Array
+(
+ [0] => %g
+ [1] => %.0g
+ [2] => %+g
+ [3] => %-g
+ [4] => %-1.2g
+ [5] => %+1.2g
+ [6] => %G
+ [7] => %.0G
+ [8] => %+G
+ [9] => %-G
+ [10] => %-1.2G
+ [11] => %+1.2G
+)
+
+123456
+-123456
+1.0e+5
+-1.0e+5
++123456
+-123456
+123456
+-123456
+120000
+-120000
++120000
+-120000
+123456
+-123456
+1.0E+5
+-1.0E+5
++123456
+-123456
+123456
+-123456
+120000
+-120000
++120000
+-120000
+
+*** Output for '%%%.2f' as the format parameter ***
+%12345678900.00
+
+*** Output for '%%' as the format parameter ***
+%
+
+*** Output for precision value more than maximum ***
+12345678900.0000000000000000000000000000000000000000
+
+*** Output for invalid width(-15) specifier ***
+15s
+
+*** Output for '%F' as the format parameter ***
+12345678900.000000
+
+*** Output for '%X' as the format parameter ***
+C
+
+*** Output with no format parameter ***
+12345
+
+*** Output for multiple format parameters ***
+12345 abcdefghjklmnpqrstuvwxyz 12345
+
+
+*** Output for excess of mixed type arguments ***
+abcdefghjklmnpqrstuvwxyz
+
+*** Output for string format parameter and integer type argument ***
+12345
+
+*** Output for integer format parameter and string type argument ***
+0
diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt
new file mode 100755
index 000000000..01ba34182
--- /dev/null
+++ b/ext/standard/tests/strings/printf_64bit.phpt
@@ -0,0 +1,695 @@
+--TEST--
+Test printf() function (64bit)
+--SKIPIF--
+<?php
+if (!(PHP_INT_MAX > 2147483647)) {
+ die("skip 64bit test only");
+}
+?>
+--FILE--
+<?php
+
+/* Various input arrays for different format types */
+
+$float_variation = array( "%f", "%-f", "%+f", "%7.2f", "%-7.2f", "%07.2f", "%-07.2f", "%'#7.2f" );
+$float_numbers = array( 0, 1, -1, 0.32, -0.32, 3.4. -3.4, 2.54, -2.54, 1.2345678e99, -1.2345678e99 );
+
+$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+$char_variation = array( 'a', "a", 67, -67, 99 );
+
+$string_variation = array( "%5s", "%-5s", "%05s", "%'#5s" );
+$strings = array( NULL, "abc", 'aaa' );
+
+/* Checking warning messages */
+
+/* Zero argument */
+echo "\n*** Output for zero argument ***\n";
+printf();
+
+/* Number of arguments not matching as specified in format field */
+echo "\n*** Output for insufficient number of arguments ***\n";
+$string = "dingy%sflem%dwombat";
+$nbr = 5;
+$name = "voudras";
+printf("%d $string %s", $nbr, $name);
+
+
+/* Scalar argument */
+echo "\n*** Output for scalar argument ***\n";
+printf(3);
+
+/* NULL argument */
+echo "\n*** Output for NULL as argument ***\n";
+printf(NULL);
+
+
+/* Float type variations */
+
+$counter = 1;
+echo "\n\n*** Output for float type ***\n";
+echo "\n Input Float numbers variation array is:\n";
+print_r($float_numbers);
+
+foreach( $float_variation as $float_var )
+{
+ echo "\n\nFloat Iteration $counter";
+ foreach( $float_numbers as $float_num )
+ {
+ echo "\n";
+ printf( $float_var, $float_num );
+ }
+ $counter++;
+}
+
+
+/* Integer type variations */
+
+$counter = 1;
+echo "\n\n*** Output for integer type ***\n";
+echo "\n Input Integer numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_variation as $int_var )
+{
+ echo "\n\nInteger Iteration $counter";
+ foreach( $int_numbers as $int_num )
+ {
+ echo "\n";
+ printf( $int_var, $int_num );
+ }
+ $counter++;
+}
+
+
+/* Binary type variations */
+
+echo "\n\n*** Output for binary type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+ foreach( $int_numbers as $bin_num )
+ {
+ echo "\n";
+ printf( "%b", $bin_num );
+ }
+
+
+/* Chararter type variations */
+echo "\n\n*** Output for char type ***\n";
+echo "\n Input Characters variation array is:\n";
+print_r($char_variation);
+
+foreach( $char_variation as $char )
+{
+ echo "\n";
+ printf( "%c", $char );
+}
+
+/* Scientific type variations */
+echo "\n\n*** Output for scientific type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $num )
+{
+ echo "\n";
+ printf( "%e", $num );
+}
+
+/* Unsigned Integer type variation */
+echo "\n\n*** Output for unsigned integer type ***\n";
+echo "\n Input Integer numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $unsig_num )
+{
+ echo "\n";
+ printf( "%u", $unsig_num );
+}
+
+/* Octal type variations */
+echo "\n\n*** Output for octal type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $octal_num )
+{
+ echo "\n";
+ printf( "%o", $octal_num );
+}
+
+/* Hexadecimal type variations */
+echo "\n\n*** Output for hexadecimal type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $hexa_num )
+{
+ echo "\n";
+ printf( "%x", $hexa_num );
+}
+
+/* String type variations */
+echo "\n\n*** Output for string type ***\n";
+echo "\n Input Strings format variation array is:\n";
+print_r($string_variation);
+echo "\n Input strings variation array is:\n";
+print_r($strings);
+
+foreach( $string_variation as $string_var )
+{
+ foreach( $strings as $str )
+ {
+ echo "\n";
+ printf( $string_var, $str );
+ }
+}
+
+
+/* variations of %g type */
+$format_g = array("%g", "%.0g", "%+g", "%-g", "%-1.2g", "%+1.2g", "%G", "%.0G", "%+G", "%-G", "%-1.2G", "%+1.2G");
+
+echo "\n\n*** Output for '%g' type ***\n";
+echo "\n Input format variation array is:\n";
+print_r($format_g);
+
+foreach( $format_g as $formatg )
+{
+ printf("\n$formatg",123456);
+ printf("\n$formatg",-123456);
+}
+
+
+/* Some more typical cases */
+
+$tempnum = 12345;
+$tempstring = "abcdefghjklmnpqrstuvwxyz";
+
+echo"\n\n*** Output for '%%%.2f' as the format parameter ***\n";
+printf("%%%.2f",1.23456789e10);
+
+echo"\n\n*** Output for '%%' as the format parameter ***\n";
+printf("%%",1.23456789e10);
+
+echo"\n\n*** Output for precision value more than maximum ***\n";
+printf("%.988f",1.23456789e10);
+
+echo"\n\n*** Output for invalid width(-15) specifier ***\n";
+printf("%030.-15s", $tempstring);
+
+echo"\n\n*** Output for '%F' as the format parameter ***\n";
+printf("%F",1.23456789e10);
+
+echo"\n\n*** Output for '%X' as the format parameter ***\n";
+printf("%X",12);
+
+echo"\n\n*** Output with no format parameter ***\n";
+printf($tempnum);
+
+echo"\n\n*** Output for multiple format parameters ***\n";
+printf("%d %s %d\n", $tempnum, $tempstring, $tempnum);
+
+echo"\n\n*** Output for excess of mixed type arguments ***\n";
+printf("%s", $tempstring, $tempstring, $tempstring);
+
+echo"\n\n*** Output for string format parameter and integer type argument ***\n";
+printf("%s", $tempnum);
+
+echo"\n\n*** Output for integer format parameter and string type argument ***\n";
+printf("%d", $tempstring);
+
+
+?>
+--EXPECTF--
+*** Output for zero argument ***
+
+Warning: Wrong parameter count for printf() in %s on line %d
+
+*** Output for insufficient number of arguments ***
+
+Warning: printf(): Too few arguments in %s on line %d
+
+*** Output for scalar argument ***
+3
+*** Output for NULL as argument ***
+
+
+*** Output for float type ***
+
+ Input Float numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 0.32
+ [4] => -0.32
+ [5] => 3.4-3.4
+ [6] => 2.54
+ [7] => -2.54
+ [8] => 1.2345678E+99
+ [9] => -1.2345678E+99
+)
+
+
+Float Iteration 1
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+
+Float Iteration 2
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+
+Float Iteration 3
++0.000000
++1.000000
+-1.000000
++0.320000
+-0.320000
++3.400000
++2.540000
+-2.540000
++1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+
+Float Iteration 4
+ 0.00
+ 1.00
+ -1.00
+ 0.32
+ -0.32
+ 3.40
+ 2.54
+ -2.54
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+Float Iteration 5
+0.00
+1.00
+-1.00
+0.32
+-0.32
+3.40
+2.54
+-2.54
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+Float Iteration 6
+0000.00
+0001.00
+-001.00
+0000.32
+-000.32
+0003.40
+0002.54
+-002.54
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+Float Iteration 7
+0.00000
+1.00000
+-1.0000
+0.32000
+-0.3200
+3.40000
+2.54000
+-2.5400
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+Float Iteration 8
+###0.00
+###1.00
+##-1.00
+###0.32
+##-0.32
+###3.40
+###2.54
+##-2.54
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+*** Output for integer type ***
+
+ Input Integer numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+
+Integer Iteration 1
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 2
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 3
++0
++1
+-1
++2
+-2
++23333333
+-23333333
++1234
+
+Integer Iteration 4
+ 0
+ 1
+ -1
+ 2
+ -2
+23333333
+-23333333
+ 1234
+
+Integer Iteration 5
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 6
+0000000
+0000001
+-000001
+0000002
+-000002
+23333333
+-23333333
+0001234
+
+Integer Iteration 7
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 8
+######0
+######1
+#####-1
+######2
+#####-2
+23333333
+-23333333
+###1234
+
+*** Output for binary type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+1111111111111111111111111111111111111111111111111111111111111111
+10
+1111111111111111111111111111111111111111111111111111111111111110
+1011001000000100111010101
+1111111111111111111111111111111111111110100110111111011000101011
+10011010010
+
+*** Output for char type ***
+
+ Input Characters variation array is:
+Array
+(
+ [0] => a
+ [1] => a
+ [2] => 67
+ [3] => -67
+ [4] => 99
+)
+
+
+
+C
+c
+
+*** Output for scientific type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0.000000e+0
+1.000000e+0
+-1.000000e+0
+2.700000e+0
+-2.700000e+0
+2.333333e+7
+-2.333333e+7
+1.234000e+3
+
+*** Output for unsigned integer type ***
+
+ Input Integer numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+4294967295
+2
+4294967294
+23333333
+4271633963
+1234
+
+*** Output for octal type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+1777777777777777777777
+2
+1777777777777777777776
+131004725
+1777777777777646773053
+2322
+
+*** Output for hexadecimal type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+ffffffffffffffff
+2
+fffffffffffffffe
+16409d5
+fffffffffe9bf62b
+4d2
+
+*** Output for string type ***
+
+ Input Strings format variation array is:
+Array
+(
+ [0] => %5s
+ [1] => %-5s
+ [2] => %05s
+ [3] => %'#5s
+)
+
+ Input strings variation array is:
+Array
+(
+ [0] =>
+ [1] => abc
+ [2] => aaa
+)
+
+
+ abc
+ aaa
+
+abc
+aaa
+00000
+00abc
+00aaa
+#####
+##abc
+##aaa
+
+*** Output for '%g' type ***
+
+ Input format variation array is:
+Array
+(
+ [0] => %g
+ [1] => %.0g
+ [2] => %+g
+ [3] => %-g
+ [4] => %-1.2g
+ [5] => %+1.2g
+ [6] => %G
+ [7] => %.0G
+ [8] => %+G
+ [9] => %-G
+ [10] => %-1.2G
+ [11] => %+1.2G
+)
+
+123456
+-123456
+1.0e+5
+-1.0e+5
++123456
+-123456
+123456
+-123456
+120000
+-120000
++120000
+-120000
+123456
+-123456
+1.0E+5
+-1.0E+5
++123456
+-123456
+123456
+-123456
+120000
+-120000
++120000
+-120000
+
+*** Output for '%%%.2f' as the format parameter ***
+%12345678900.00
+
+*** Output for '%%' as the format parameter ***
+%
+
+*** Output for precision value more than maximum ***
+12345678900.0000000000000000000000000000000000000000
+
+*** Output for invalid width(-15) specifier ***
+15s
+
+*** Output for '%F' as the format parameter ***
+12345678900.000000
+
+*** Output for '%X' as the format parameter ***
+C
+
+*** Output with no format parameter ***
+12345
+
+*** Output for multiple format parameters ***
+12345 abcdefghjklmnpqrstuvwxyz 12345
+
+
+*** Output for excess of mixed type arguments ***
+abcdefghjklmnpqrstuvwxyz
+
+*** Output for string format parameter and integer type argument ***
+12345
+
+*** Output for integer format parameter and string type argument ***
+0
diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt
new file mode 100644
index 000000000..329ead420
--- /dev/null
+++ b/ext/standard/tests/strings/rtrim.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sha1.phpt b/ext/standard/tests/strings/sha1.phpt
index c405eedde..ed8f47457 100644
--- a/ext/standard/tests/strings/sha1.phpt
+++ b/ext/standard/tests/strings/sha1.phpt
@@ -2,13 +2,50 @@
sha1() with ASCII output
--FILE--
<?php
-echo sha1("abc")."\n";
-echo sha1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")."\n";
-echo sha1("a")."\n";
-echo sha1("0123456701234567012345670123456701234567012345670123456701234567")."\n";
+
+$filename = dirname(__FILE__)."/sha1.dat";
+$a = array(
+ "abc",
+ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+ "a",
+ "0123456701234567012345670123456701234567012345670123456701234567",
+ ""
+);
+
+foreach ($a as $str) {
+ var_dump($val1 = sha1($str));
+ file_put_contents($filename, $str);
+ var_dump($val2 = sha1_file($filename));
+ var_dump($val1 === $val2);
+}
+
+var_dump(sha1($str, true));
+var_dump(sha1_file($filename, true));
+
+@unlink($filename);
+
+sha1_file($filename);
+
+echo "Done\n";
?>
---EXPECT--
-a9993e364706816aba3e25717850c26c9cd0d89d
-84983e441c3bd26ebaae4aa1f95129e5e54670f1
-86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
-e0c094e867ef46c350ef54a7f59dd60bed92ae83
+--EXPECTF--
+string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
+string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
+bool(true)
+string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1"
+string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1"
+bool(true)
+string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
+string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
+bool(true)
+string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83"
+string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83"
+bool(true)
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+bool(true)
+string(20) "%s"
+string(20) "%s"
+
+Warning: sha1_file(%ssha1.dat): failed to open stream: No such file or directory in %s on line %d
+Done
diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt
new file mode 100644
index 000000000..55769ad57
--- /dev/null
+++ b/ext/standard/tests/strings/soundex.phpt
@@ -0,0 +1,55 @@
+--TEST--
+soundex() tests
+--FILE--
+<?php
+
+var_dump(soundex(""));
+var_dump(soundex(-1));
+var_dump(soundex(array()));
+
+$array = array(
+"From",
+"that",
+"time",
+"on",
+"Sam",
+"thought",
+"that",
+"he",
+"sensed",
+"a",
+"change",
+"in",
+"Gollum",
+"again.",
+"He was more fawning and would-be friendly; but Sam surprised some strange looks in his eyes at times, especially towards Frodo."
+);
+
+foreach ($array as $str) {
+ var_dump(soundex($str));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+string(4) "0000"
+
+Warning: soundex() expects parameter 1 to be string, array given in %s on line %d
+NULL
+string(4) "F650"
+string(4) "T300"
+string(4) "T500"
+string(4) "O500"
+string(4) "S500"
+string(4) "T230"
+string(4) "T300"
+string(4) "H000"
+string(4) "S523"
+string(4) "A000"
+string(4) "C520"
+string(4) "I500"
+string(4) "G450"
+string(4) "A250"
+string(4) "H256"
+Done
diff --git a/ext/standard/tests/strings/sprintf_f.phpt b/ext/standard/tests/strings/sprintf_f.phpt
index 6135270d2..6cba6d10b 100755
--- a/ext/standard/tests/strings/sprintf_f.phpt
+++ b/ext/standard/tests/strings/sprintf_f.phpt
@@ -37,4 +37,4 @@ string(7) "-5.60 "
string(7) "-005.60"
string(7) "-5.6000"
-string(105) "12345678%d00000000000000000000000000000000000000000000000000.0000" \ No newline at end of file
+string(105) "1234567%d.0000"
diff --git a/ext/standard/tests/strings/sprintf_f_2.phpt b/ext/standard/tests/strings/sprintf_f_2.phpt
new file mode 100755
index 000000000..d6006356f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_f_2.phpt
@@ -0,0 +1,114 @@
+--TEST--
+sprintf %f #2
+--FILE--
+<?php
+var_dump(sprintf("%.3F", 100.426));
+var_dump(sprintf("%.2F", 100.426));
+var_dump(sprintf("%d", 100.426));
+var_dump(sprintf("%d", 100.9));
+var_dump(sprintf("%o", 100.426));
+var_dump(sprintf("%o", 100.9));
+
+/* copy & paste from the docs */
+
+/* example#1: Argument swapping */
+$num = 100.1;
+$location = "world";
+
+$format = 'There are %d monkeys in the %s';
+var_dump(sprintf($format, $num, $location));
+
+/* example#2: Argument swapping */
+$format = 'The %s contains %d monkeys';
+var_dump(sprintf($format, $num, $location));
+
+/* example#3: Argument swapping */
+$format = 'The %2$s contains %1$d monkeys';
+var_dump(sprintf($format, $num, $location));
+
+/* example#4: Argument swapping */
+$format = 'The %2$s contains %1$d monkeys.
+ That\'s a nice %2$s full of %1$d monkeys.';
+var_dump(sprintf($format, $num, $location));
+
+/* example#5: various examples */
+$n = 43951789;
+$u = -43951789;
+$c = 65; // ASCII 65 is 'A'
+
+// notice the double %%, this prints a literal '%' character
+var_dump(sprintf("%%b = '%b'", $n)); // binary representation
+var_dump(sprintf("%%c = '%c'", $c)); // print the ascii character, same as chr() function
+var_dump(sprintf("%%d = '%d'", $n)); // standard integer representation
+var_dump(sprintf("%%e = '%e'", $n)); // scientific notation
+var_dump(sprintf("%%u = '%u'", $n)); // unsigned integer representation of a positive integer
+var_dump(sprintf("%%u = '%u'", $u)); // unsigned integer representation of a negative integer
+var_dump(sprintf("%%f = '%f'", $n)); // floating point representation
+var_dump(sprintf("%%o = '%o'", $n)); // octal representation
+var_dump(sprintf("%%s = '%s'", $n)); // string representation
+var_dump(sprintf("%%x = '%x'", $n)); // hexadecimal representation (lower-case)
+var_dump(sprintf("%%X = '%X'", $n)); // hexadecimal representation (upper-case)
+
+var_dump(sprintf("%%+d = '%+d'", $n)); // sign specifier on a positive integer
+var_dump(sprintf("%%+d = '%+d'", $u)); // sign specifier on a negative integer
+
+
+/* example#6: string specifiers */
+$s = 'monkey';
+$t = 'many monkeys';
+
+var_dump(sprintf("[%s]", $s)); // standard string output
+var_dump(sprintf("[%10s]", $s)); // right-justification with spaces
+var_dump(sprintf("[%-10s]", $s)); // left-justification with spaces
+var_dump(sprintf("[%010s]", $s)); // zero-padding works on strings too
+var_dump(sprintf("[%'#10s]", $s)); // use the custom padding character '#'
+var_dump(sprintf("[%10.10s]", $t)); // left-justification but with a cutoff of 10 characters
+
+/* example#7: zero-padded integers */
+var_dump(sprintf("%04d-%02d-%02d", 2006, 12, 18));
+
+/* example#8: formatting currency */
+$money1 = 68.75;
+$money2 = 54.35;
+$money = $money1 + $money2;
+var_dump(sprintf("%01.2f", $money)); // output "123.10"
+
+/* example#9: scientific notation */
+$number = 362525200;
+
+var_dump(sprintf("%.3e", $number)); // outputs 3.63e+8
+?>
+--EXPECT--
+string(7) "100.426"
+string(6) "100.43"
+string(3) "100"
+string(3) "100"
+string(3) "144"
+string(3) "144"
+string(34) "There are 100 monkeys in the world"
+string(28) "The 100.1 contains 0 monkeys"
+string(30) "The world contains 100 monkeys"
+string(76) "The world contains 100 monkeys.
+ That's a nice world full of 100 monkeys."
+string(33) "%b = '10100111101010011010101101'"
+string(8) "%c = 'A'"
+string(15) "%d = '43951789'"
+string(18) "%e = '4.395179e+7'"
+string(15) "%u = '43951789'"
+string(17) "%u = '4251015507'"
+string(22) "%f = '43951789.000000'"
+string(16) "%o = '247523255'"
+string(15) "%s = '43951789'"
+string(14) "%x = '29ea6ad'"
+string(14) "%X = '29EA6AD'"
+string(17) "%+d = '+43951789'"
+string(17) "%+d = '-43951789'"
+string(8) "[monkey]"
+string(12) "[ monkey]"
+string(12) "[monkey ]"
+string(12) "[0000monkey]"
+string(12) "[####monkey]"
+string(12) "[many monke]"
+string(10) "2006-12-18"
+string(6) "123.10"
+string(8) "3.625e+8"
diff --git a/ext/standard/tests/strings/sprintf_f_3.phpt b/ext/standard/tests/strings/sprintf_f_3.phpt
new file mode 100755
index 000000000..0cf123998
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_f_3.phpt
@@ -0,0 +1,23 @@
+--TEST--
+sprintf %f #3
+--SKIPIF--
+<?php if(false == setlocale(LC_NUMERIC, "is_IS", "is_IS.UTF-8")) print "skip icelandic locale not supported"; ?>
+--FILE--
+<?php
+setlocale(LC_NUMERIC, "is_IS", "is_IS.UTF-8");
+var_dump(sprintf("%.3f", 100.426));
+var_dump(sprintf("%.2f", 100.426));
+var_dump(sprintf("%f'", 100.426));
+
+$money1 = 68.75;
+$money2 = 54.35;
+$money = $money1 + $money2;
+var_dump(sprintf("%01.2f", $money));
+var_dump(sprintf("%.3e", $money));
+?>
+--EXPECT--
+string(7) "100,426"
+string(6) "100,43"
+string(11) "100,426000'"
+string(6) "123,10"
+string(8) "1.231e+2"
diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt
new file mode 100644
index 000000000..4d4fee8f9
--- /dev/null
+++ b/ext/standard/tests/strings/str_ireplace.phpt
@@ -0,0 +1,101 @@
+--TEST--
+str_ireplace() tests
+--FILE--
+<?php
+
+var_dump(str_ireplace());
+var_dump(str_ireplace(""));
+var_dump(str_ireplace("", ""));
+var_dump(str_ireplace("", "", ""));
+
+var_dump(str_ireplace("tt", "a", "ttttTttttttttTT"));
+var_dump(str_ireplace("tt", "a", "ttttTttttttttTT", $count));
+var_dump($count);
+
+var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT"));
+var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT", $count));
+var_dump($count);
+
+var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
+var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
+var_dump($count);
+
+var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
+var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
+var_dump($count);
+
+var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
+var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
+var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));
+
+var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
+var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
+var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));
+
+var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("ttttTttttttttTT", "aayyaayasdayYahsdYYY")));
+var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));
+var_dump(str_ireplace(array("t"=>"tt", "y"=>"y"), array("a"=>"aaa", "b"=>"bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));
+
+/* separate testcase for str_ireplace() off-by-one */
+
+$Data = "Change tracking and management software designed to watch
+ for abnormal system behavior.\nSuggest features, report bugs, or ask
+ questions here.";
+var_dump($Data = str_ireplace("\r\n", "<br>", $Data));
+var_dump($Data = str_ireplace("\n", "<br>", $Data));
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Wrong parameter count for str_ireplace() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for str_ireplace() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for str_ireplace() in %s on line %d
+NULL
+string(0) ""
+string(8) "aaaaaaaT"
+string(8) "aaaaaaaT"
+int(7)
+string(15) "aaaaaaaaaaaaaaT"
+string(15) "aaaaaaaaaaaaaaT"
+int(7)
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+int(7)
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+int(7)
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+array(2) {
+ [0]=>
+ string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+ [1]=>
+ string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
+}
+array(2) {
+ ["key"]=>
+ string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+ ["test"]=>
+ string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
+}
+array(2) {
+ ["key"]=>
+ string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+ ["test"]=>
+ string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
+}
+string(143) "Change tracking and management software designed to watch
+ for abnormal system behavior.
+Suggest features, report bugs, or ask
+ questions here."
+string(152) "Change tracking and management software designed to watch<br> for abnormal system behavior.<br>Suggest features, report bugs, or ask<br> questions here."
+Done
diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
new file mode 100644
index 000000000..d6111b034
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt
new file mode 100644
index 000000000..ee9799864
--- /dev/null
+++ b/ext/standard/tests/strings/strcasecmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt
new file mode 100644
index 000000000..b27da6c37
--- /dev/null
+++ b/ext/standard/tests/strings/strcmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt
new file mode 100644
index 000000000..5c617a20d
--- /dev/null
+++ b/ext/standard/tests/strings/stristr.phpt
@@ -0,0 +1,43 @@
+--TEST--
+stristr() function
+--FILE--
+<?php
+ var_dump(stristr());
+ var_dump(stristr(array(), ""));
+ var_dump(stristr("", array()));
+ var_dump(stristr(array(), array()));
+ var_dump(stristr("tEsT sTrInG", "tEsT"));
+ var_dump(stristr("tEsT sTrInG", "stRiNg"));
+ var_dump(stristr("tEsT sTrInG", "stRiN"));
+ var_dump(stristr("tEsT sTrInG", "t S"));
+ var_dump(stristr("tEsT sTrInG", "g"));
+ var_dump(md5(stristr("te".chr(0)."st", chr(0))));
+ var_dump(@stristr("", ""));
+ var_dump(@stristr("a", ""));
+ var_dump(@stristr("", "a"));
+ var_dump(md5(@stristr("\\\\a\\", "\\a")));
+ var_dump(stristr("tEsT sTrInG", " "));
+?>
+--EXPECTF--
+Warning: Wrong parameter count for stristr() in %s on line %d
+NULL
+
+Notice: Array to string conversion in %s on line %d
+
+Warning: stristr(): Empty delimiter. in %s on line %d
+bool(false)
+bool(false)
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+string(11) "tEsT sTrInG"
+string(6) "sTrInG"
+string(6) "sTrInG"
+string(8) "T sTrInG"
+string(1) "G"
+string(32) "7272696018bdeb2c9a3f8d01fc2a9273"
+bool(false)
+bool(false)
+bool(false)
+string(32) "6ec19f52f0766c463f3bb240f4396913"
+string(7) " sTrInG"
diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt
new file mode 100644
index 000000000..41529b39f
--- /dev/null
+++ b/ext/standard/tests/strings/strlen.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt
index 594aed173..66a82a878 100644
--- a/ext/standard/tests/strings/substr_compare.phpt
+++ b/ext/standard/tests/strings/substr_compare.phpt
@@ -24,7 +24,7 @@ int(0)
int(1)
int(-1)
-Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
+Warning: substr_compare(): The length cannot exceed initial string length in %s on line %d
bool(false)
Warning: substr_compare() expects parameter 5 to be boolean, object given in %s on line %d
diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt
new file mode 100644
index 000000000..eebc4cc9c
--- /dev/null
+++ b/ext/standard/tests/strings/ucfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt
new file mode 100644
index 000000000..9c77a5072
--- /dev/null
+++ b/ext/standard/tests/strings/uuencode.phpt
@@ -0,0 +1,40 @@
+--TEST--
+uuencode family tests
+--FILE--
+<?php
+
+var_dump(convert_uuencode(array()));
+var_dump(convert_uudecode(array()));
+
+var_dump(convert_uuencode(""));
+var_dump(convert_uudecode(""));
+var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ"));
+var_dump(convert_uudecode("!@#$%^YUGFDFGHJKLUYTFBNMLOYT"));
+var_dump(convert_uudecode($enc));
+var_dump($enc = convert_uuencode("not very sophisticated"));
+var_dump(convert_uudecode($enc));
+var_dump(convert_uudecode(substr($enc, 0, -10)));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA:
+`
+"
+string(1) "%s"
+string(42) "~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ"
+string(36) "6;F]T('9E<GD@<V]P:&ES=&EC871E9```
+`
+"
+string(22) "not very sophisticated"
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string. in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/time/bug38524.phpt b/ext/standard/tests/time/bug38524.phpt
index e9ccaaf38..77d0f4f23 100755
--- a/ext/standard/tests/time/bug38524.phpt
+++ b/ext/standard/tests/time/bug38524.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #38524 (strptime() does not initialize the internal date storage structure)
+--SKIPIF--
+<?php if (!function_exists('strptime')) echo "SKIP"; ?>
--FILE--
<?php
var_dump(strptime('2006-08-20', '%Y-%m-%d'));