summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:07 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:07 -0400
commitbb01389fbd53ec1cbcb80d0681a37cca1267891a (patch)
tree4783178fca65a5d9071c8df34f2ddc3d31728673 /ext/standard/tests/strings
parenteddbbea4325e602ddc87c545531609132d4f0e3b (diff)
downloadphp-upstream/5.2.4.tar.gz
Imported Upstream version 5.2.4upstream/5.2.4
Diffstat (limited to 'ext/standard/tests/strings')
-rw-r--r--ext/standard/tests/strings/bug23894.phpt10
-rw-r--r--ext/standard/tests/strings/bug26973.phpt20
-rw-r--r--ext/standard/tests/strings/bug40754.phpt2
-rw-r--r--ext/standard/tests/strings/bug42107.phpt47
-rw-r--r--ext/standard/tests/strings/bug42208.phpt15
-rw-r--r--ext/standard/tests/strings/chunk_split.phpt7
-rw-r--r--ext/standard/tests/strings/fprintf_error.phpt31
-rw-r--r--ext/standard/tests/strings/fprintf_variation_001.phpt124
-rw-r--r--ext/standard/tests/strings/fprintf_variation_002.phpt124
-rw-r--r--ext/standard/tests/strings/fprintf_variation_003.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_003_64bit.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_004.phptbin0 -> 734 bytes
-rw-r--r--ext/standard/tests/strings/fprintf_variation_005.phpt46
-rw-r--r--ext/standard/tests/strings/fprintf_variation_006.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_006_64bit.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_007.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_007_64bit.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_008.phpt48
-rw-r--r--ext/standard/tests/strings/fprintf_variation_008_64bit.phpt48
-rw-r--r--ext/standard/tests/strings/fprintf_variation_009.phpt64
-rwxr-xr-xext/standard/tests/strings/moneyformat.phpt19
-rw-r--r--ext/standard/tests/strings/pack.phpt2
-rwxr-xr-xext/standard/tests/strings/printf_64bit.phpt6
-rwxr-xr-xext/standard/tests/strings/sprintf_f_2.phpt68
-rw-r--r--ext/standard/tests/strings/str_pad.phptbin9091 -> 9783 bytes
-rw-r--r--ext/standard/tests/strings/strcspn.phpt2
-rw-r--r--ext/standard/tests/strings/strtolower-win32.phptbin0 -> 4835 bytes
-rw-r--r--ext/standard/tests/strings/strtolower.phptbin0 -> 4806 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper1-win32.phptbin0 -> 4846 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper1.phptbin0 -> 4817 bytes
-rw-r--r--ext/standard/tests/strings/substr_count_basic.phpt33
-rw-r--r--ext/standard/tests/strings/substr_count_error.phpt65
-rw-r--r--ext/standard/tests/strings/substr_count_variation_001.phpt (renamed from ext/standard/tests/strings/substr_count.phpt)76
-rw-r--r--ext/standard/tests/strings/substr_count_variation_002.phpt53
-rw-r--r--ext/standard/tests/strings/unpack.phpt11
-rw-r--r--ext/standard/tests/strings/wordwrap.phpt2
36 files changed, 1076 insertions, 129 deletions
diff --git a/ext/standard/tests/strings/bug23894.phpt b/ext/standard/tests/strings/bug23894.phpt
index 9cc0316a2..3455081f1 100644
--- a/ext/standard/tests/strings/bug23894.phpt
+++ b/ext/standard/tests/strings/bug23894.phpt
@@ -8,8 +8,8 @@ var_dump($test, bin2hex($test));
$test = sprintf("% 13u", $a);
var_dump($test, bin2hex($test));
?>
---EXPECT--
-string(4) "-012"
-string(8) "2d303132"
-string(13) " 4294967284"
-string(26) "20202034323934393637323834"
+--EXPECTREGEX--
+string\(4\) \"-012\"
+string\(8\) \"2d303132\"
+(string\(13\) \" 4294967284\"|string\(20\) \"18446744073709551604\")
+(string\(26\) \"20202034323934393637323834\"|string\(40\) \"3138343436373434303733373039353531363034\")
diff --git a/ext/standard/tests/strings/bug26973.phpt b/ext/standard/tests/strings/bug26973.phpt
index 4a586ecaa..9de3be492 100644
--- a/ext/standard/tests/strings/bug26973.phpt
+++ b/ext/standard/tests/strings/bug26973.phpt
@@ -18,17 +18,17 @@ printf("%05u\n", 200);
printf("%05u\n", -200);
?>
---EXPECT--
-+0200
--0200
-+200.000000
--200.000000
+--EXPECTREGEX--
+\+0200
+\-0200
+\+200\.000000
+\-200\.000000
00200
-4294967096
+(4294967096|18446744073709551416)
---
00200
--0200
-200.000000
--200.000000
+\-0200
+200\.000000
+\-200\.000000
00200
-4294967096
+(4294967096|18446744073709551416)
diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt
index 23a459317..31570bf2b 100644
--- a/ext/standard/tests/strings/bug40754.phpt
+++ b/ext/standard/tests/strings/bug40754.phpt
@@ -28,7 +28,7 @@ var_dump(substr("abcde", $v, $v));
?>
--EXPECTF--
string(4) "bcde"
-bool(false)
+string(6) "abcdex"
bool(false)
bool(false)
diff --git a/ext/standard/tests/strings/bug42107.phpt b/ext/standard/tests/strings/bug42107.phpt
new file mode 100644
index 000000000..d97f8917e
--- /dev/null
+++ b/ext/standard/tests/strings/bug42107.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Bug #42107 (sscanf() broken when using %2$s type format parameters)
+--FILE--
+<?php
+
+var_dump(sscanf('one two', '%1$s %2$s'));
+var_dump(sscanf('one two', '%2$s %1$s'));
+echo "--\n";
+sscanf('one two', '%1$s %2$s', $foo, $bar);
+var_dump($foo, $bar);
+sscanf('one two', '%2$s %1$s', $foo, $bar);
+var_dump($foo, $bar);
+echo "--\n";
+var_dump(sscanf('one two', '%1$d %2$d'));
+var_dump(sscanf('one two', '%1$d'));
+echo "Done\n";
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+array(2) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(3) "one"
+}
+--
+string(3) "one"
+string(3) "two"
+string(3) "two"
+string(3) "one"
+--
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+Done
diff --git a/ext/standard/tests/strings/bug42208.phpt b/ext/standard/tests/strings/bug42208.phpt
new file mode 100644
index 000000000..72488a93d
--- /dev/null
+++ b/ext/standard/tests/strings/bug42208.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #42208 (substr_replace() crashes when the same array is passed more than once)
+--FILE--
+<?php
+$a = array(1, 2);
+$c = $a;
+var_dump(substr_replace($a, 1, 1, $c));
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(2) "11"
+ [1]=>
+ string(2) "21"
+}
diff --git a/ext/standard/tests/strings/chunk_split.phpt b/ext/standard/tests/strings/chunk_split.phpt
index cfb817def..648388f23 100644
--- a/ext/standard/tests/strings/chunk_split.phpt
+++ b/ext/standard/tests/strings/chunk_split.phpt
@@ -12,6 +12,12 @@ $b=1;
$c=str_repeat("B", 65535);
var_dump(chunk_split($a,$b,$c));
+$a=str_repeat("B", 65537);
+$b=1;
+$c=str_repeat("B", 65537);
+var_dump(chunk_split($a,$b,$c));
+
+
?>
--EXPECT--
a-b-c-
@@ -25,3 +31,4 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
test|end
bool(false)
+bool(false)
diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt
new file mode 100644
index 000000000..cd6468bba
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test fprintf() function (errors)
+--FILE--
+<?php
+
+/* Testing Error Conditions */
+echo "*** Testing Error Conditions ***\n";
+
+/* zero argument */
+var_dump( fprintf() );
+
+/* scalar argument */
+var_dump( fprintf(3) );
+
+/* NULL argument */
+var_dump( fprintf(NULL) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for fprintf() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for fprintf() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for fprintf() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_001.phpt b/ext/standard/tests/strings/fprintf_variation_001.phpt
new file mode 100644
index 000000000..f08d5cbee
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_001.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test fprintf() function (variation - 1)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+?>
+--FILE--
+<?php
+
+$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 );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+$counter = 1;
+/* float type variations */
+fprintf($fp, "\n*** Testing fprintf() with floats ***\n");
+
+foreach( $float_variation as $float_var ) {
+ fprintf( $fp, "\n-- Iteration %d --\n",$counter);
+ foreach( $float_numbers as $float_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, $float_var, $float_num );
+ }
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with floats ***
+
+-- Iteration 1 --
+
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+-- Iteration 2 --
+
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+-- Iteration 3 --
+
++0.000000
++1.000000
+-1.000000
++0.320000
+-0.320000
++3.400000
++2.540000
+-2.540000
+-- Iteration 4 --
+
+ 0.00
+ 1.00
+ -1.00
+ 0.32
+ -0.32
+ 3.40
+ 2.54
+ -2.54
+-- Iteration 5 --
+
+0.00
+1.00
+-1.00
+0.32
+-0.32
+3.40
+2.54
+-2.54
+-- Iteration 6 --
+
+0000.00
+0001.00
+-001.00
+0000.32
+-000.32
+0003.40
+0002.54
+-002.54
+-- Iteration 7 --
+
+0.00000
+1.00000
+-1.0000
+0.32000
+-0.3200
+3.40000
+2.54000
+-2.5400
+-- Iteration 8 --
+
+###0.00
+###1.00
+##-1.00
+###0.32
+##-0.32
+###3.40
+###2.54
+##-2.54
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_002.phpt b/ext/standard/tests/strings/fprintf_variation_002.phpt
new file mode 100644
index 000000000..fb3ab6c14
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_002.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test fprintf() function (variation - 2)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+?>
+--FILE--
+<?php
+
+$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" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+$counter = 1;
+/* integer type variations */
+fprintf($fp, "\n*** Testing fprintf() with integers ***\n");
+foreach( $int_variation as $int_var ) {
+ fprintf( $fp, "\n-- Iteration %d --\n",$counter);
+ foreach( $int_numbers as $int_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, $int_var, $int_num );
+ }
+ $counter++;
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with integers ***
+
+-- Iteration 1 --
+
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+-- Iteration 2 --
+
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+-- Iteration 3 --
+
++0
++1
+-1
++2
+-2
++23333333
+-23333333
++1234
+-- Iteration 4 --
+
+ 0
+ 1
+ -1
+ 2
+ -2
+23333333
+-23333333
+ 1234
+-- Iteration 5 --
+
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+-- Iteration 6 --
+
+0000000
+0000001
+-000001
+0000002
+-000002
+23333333
+-23333333
+0001234
+-- Iteration 7 --
+
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+-- Iteration 8 --
+
+######0
+######1
+#####-1
+######2
+#####-2
+23333333
+-23333333
+###1234
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_003.phpt b/ext/standard/tests/strings/fprintf_variation_003.phpt
new file mode 100644
index 000000000..c312c49d6
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_003.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 3)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* binary type variations */
+fprintf($fp, "\n*** Testing fprintf() with binary ***\n");
+foreach( $int_numbers as $bin_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%b", $bin_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with binary ***
+
+0
+1
+11111111111111111111111111111111
+10
+11111111111111111111111111111110
+1011001000000100111010101
+11111110100110111111011000101011
+10011010010
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt
new file mode 100644
index 000000000..448f5281d
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 3)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* binary type variations */
+fprintf($fp, "\n*** Testing fprintf() with binary ***\n");
+foreach( $int_numbers as $bin_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%b", $bin_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with binary ***
+
+0
+1
+1111111111111111111111111111111111111111111111111111111111111111
+10
+1111111111111111111111111111111111111111111111111111111111111110
+1011001000000100111010101
+1111111111111111111111111111111111111110100110111111011000101011
+10011010010
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_004.phpt b/ext/standard/tests/strings/fprintf_variation_004.phpt
new file mode 100644
index 000000000..5502b6d7c
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_004.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/fprintf_variation_005.phpt b/ext/standard/tests/strings/fprintf_variation_005.phpt
new file mode 100644
index 000000000..75636ac98
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_005.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test fprintf() function (variation - 5)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* %e type variations */
+fprintf($fp, "\n*** Testing fprintf() for scientific type ***\n");
+foreach( $int_numbers as $num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%e", $num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for scientific type ***
+
+0.000000e+0
+1.000000e+0
+-1.000000e+0
+2.700000e+0
+-2.700000e+0
+2.333333e+7
+-2.333333e+7
+1.234000e+3
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_006.phpt b/ext/standard/tests/strings/fprintf_variation_006.phpt
new file mode 100644
index 000000000..d7a327857
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_006.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 6)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* unsigned int type variation */
+fprintf($fp, "\n*** Testing fprintf() for unsigned integers ***\n");
+foreach( $int_numbers as $unsig_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%u", $unsig_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for unsigned integers ***
+
+0
+1
+4294967295
+2
+4294967294
+23333333
+4271633963
+1234
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt
new file mode 100644
index 000000000..d68683e3e
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 6)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* unsigned int type variation */
+fprintf($fp, "\n*** Testing fprintf() for unsigned integers ***\n");
+foreach( $int_numbers as $unsig_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%u", $unsig_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for unsigned integers ***
+
+0
+1
+18446744073709551615
+2
+18446744073709551614
+23333333
+18446744073686218283
+1234
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_007.phpt b/ext/standard/tests/strings/fprintf_variation_007.phpt
new file mode 100644
index 000000000..cb09084b7
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_007.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 7)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* octal type variations */
+fprintf($fp, "\n*** Testing fprintf() for octals ***\n");
+foreach( $int_numbers as $octal_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%o", $octal_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for octals ***
+
+0
+1
+37777777777
+2
+37777777776
+131004725
+37646773053
+2322
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt
new file mode 100644
index 000000000..c8481e9fd
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 7)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* octal type variations */
+fprintf($fp, "\n*** Testing fprintf() for octals ***\n");
+foreach( $int_numbers as $octal_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%o", $octal_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for octals ***
+
+0
+1
+1777777777777777777777
+2
+1777777777777777777776
+131004725
+1777777777777646773053
+2322
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_008.phpt b/ext/standard/tests/strings/fprintf_variation_008.phpt
new file mode 100644
index 000000000..f91e7a1a9
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_008.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test fprintf() function (variation - 8)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$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" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* hexadecimal type variations */
+fprintf($fp, "\n*** Testing fprintf() for hexadecimals ***\n");
+foreach( $int_numbers as $hexa_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%x", $hexa_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for hexadecimals ***
+
+0
+1
+ffffffff
+2
+fffffffe
+16409d5
+fe9bf62b
+4d2
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt
new file mode 100644
index 000000000..f61951022
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test fprintf() function (variation - 8)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$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" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* hexadecimal type variations */
+fprintf($fp, "\n*** Testing fprintf() for hexadecimals ***\n");
+foreach( $int_numbers as $hexa_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%x", $hexa_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for hexadecimals ***
+
+0
+1
+ffffffffffffffff
+2
+fffffffffffffffe
+16409d5
+fffffffffe9bf62b
+4d2
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_009.phpt b/ext/standard/tests/strings/fprintf_variation_009.phpt
new file mode 100644
index 000000000..40f36bb5f
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_009.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test fprintf() function (variation - 9)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+?>
+--FILE--
+<?php
+
+$string_variation = array( "%5s", "%-5s", "%05s", "%'#5s" );
+$strings = array( NULL, "abc", 'aaa' );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+$counter = 1;
+/* string type variations */
+fprintf($fp, "\n*** Testing fprintf() for string types ***\n");
+foreach( $string_variation as $string_var ) {
+ fprintf( $fp, "\n-- Iteration %d --\n",$counter);
+ foreach( $strings as $str ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, $string_var, $str );
+ }
+ $counter++;
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for string types ***
+
+-- Iteration 1 --
+
+
+ abc
+ aaa
+-- Iteration 2 --
+
+
+abc
+aaa
+-- Iteration 3 --
+
+00000
+00abc
+00aaa
+-- Iteration 4 --
+
+#####
+##abc
+##aaa
+Done
diff --git a/ext/standard/tests/strings/moneyformat.phpt b/ext/standard/tests/strings/moneyformat.phpt
new file mode 100755
index 000000000..7f14b095a
--- /dev/null
+++ b/ext/standard/tests/strings/moneyformat.phpt
@@ -0,0 +1,19 @@
+--TEST--
+money_format test
+--SKIPIF--
+<?php
+ if (!function_exists('money_format') || !function_exists('setlocale')) {
+ die("SKIP money_format - not supported\n");
+ }
+?>
+--FILE--
+<?php
+setlocale(LC_MONETARY, 'en_US');
+var_dump( money_format("X%nY", 3.1415));
+var_dump(money_format("AAAAA%n%n%n%n", NULL));
+?>
+--EXPECTF--
+string(7) "X$3.14Y"
+
+Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/strings/pack.phpt b/ext/standard/tests/strings/pack.phpt
index b36eee1e5..f64c24c96 100644
--- a/ext/standard/tests/strings/pack.phpt
+++ b/ext/standard/tests/strings/pack.phpt
@@ -97,7 +97,7 @@ print_r(unpack("v", pack("v", -1000)));
print_r(unpack("v", pack("v", -64434)));
print_r(unpack("v", pack("v", -65535)));
?>
---EXPECT--
+--EXPECTF--
Array
(
[1] => h
diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt
index 9d78d0c7a..10ea360c0 100755
--- a/ext/standard/tests/strings/printf_64bit.phpt
+++ b/ext/standard/tests/strings/printf_64bit.phpt
@@ -531,11 +531,11 @@ Array
0
1
-4294967295
+18446744073709551615
2
-4294967294
+18446744073709551614
23333333
-4271633963
+18446744073686218283
1234
*** Output for octal type ***
diff --git a/ext/standard/tests/strings/sprintf_f_2.phpt b/ext/standard/tests/strings/sprintf_f_2.phpt
index a4b71bc46..1c7cc7f92 100755
--- a/ext/standard/tests/strings/sprintf_f_2.phpt
+++ b/ext/standard/tests/strings/sprintf_f_2.phpt
@@ -80,37 +80,37 @@ $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"
+--EXPECTREGEX--
+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\(27\) \"%u = '18446744073665599827'\")
+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/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
index 6eaff1514..c9f1e56d0 100644
--- a/ext/standard/tests/strings/str_pad.phpt
+++ b/ext/standard/tests/strings/str_pad.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcspn.phpt b/ext/standard/tests/strings/strcspn.phpt
index 88bcee5c1..d948655ef 100644
--- a/ext/standard/tests/strings/strcspn.phpt
+++ b/ext/standard/tests/strings/strcspn.phpt
@@ -9,6 +9,7 @@ var_dump($b);
var_dump(strcspn($a,$b));
var_dump(strcspn($a,$b,9));
var_dump(strcspn($a,$b,9,6));
+var_dump(strcspn('a', 'B', 1, 2147483647));
?>
--EXPECT--
string(25) "22222222aaaa bbb1111 cccc"
@@ -16,3 +17,4 @@ string(4) "1234"
int(0)
int(7)
int(6)
+int(0)
diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt
new file mode 100644
index 000000000..af1290f1b
--- /dev/null
+++ b/ext/standard/tests/strings/strtolower-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt
new file mode 100644
index 000000000..a59c1c4a5
--- /dev/null
+++ b/ext/standard/tests/strings/strtolower.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt
new file mode 100644
index 000000000..283492d9d
--- /dev/null
+++ b/ext/standard/tests/strings/strtoupper1-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt
new file mode 100644
index 000000000..a1948f163
--- /dev/null
+++ b/ext/standard/tests/strings/strtoupper1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/substr_count_basic.phpt b/ext/standard/tests/strings/substr_count_basic.phpt
new file mode 100644
index 000000000..f880e9481
--- /dev/null
+++ b/ext/standard/tests/strings/substr_count_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test substr_count() function (basic)
+--FILE--
+<?php
+
+echo "***Testing basic operations ***\n";
+var_dump(@substr_count("", ""));
+var_dump(@substr_count("a", ""));
+var_dump(@substr_count("", "a"));
+var_dump(@substr_count("", "a"));
+var_dump(@substr_count("", chr(0)));
+$a = str_repeat("abcacba", 100);
+var_dump(@substr_count($a, "bca"));
+$a = str_repeat("abcacbabca", 100);
+var_dump(@substr_count($a, "bca"));
+var_dump(substr_count($a, "bca", 200));
+var_dump(substr_count($a, "bca", 200, 50));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+***Testing basic operations ***
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(100)
+int(200)
+int(160)
+int(10)
+Done
diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt
new file mode 100644
index 000000000..01d4caa6a
--- /dev/null
+++ b/ext/standard/tests/strings/substr_count_error.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test substr_count() function (error conditions)
+--FILE--
+<?php
+
+echo "\n*** Testing error conditions ***\n";
+/* Zero argument */
+var_dump( substr_count() );
+
+/* more than expected no. of args */
+var_dump( substr_count($str, "t", 0, 15, 30) );
+
+/* offset as negative value */
+var_dump(substr_count($str, "t", -5));
+
+/* offset > size of the string */
+var_dump(substr_count($str, "t", 25));
+
+/* Using offset and length to go beyond the size of the string:
+ Warning message expected, as length+offset > length of string */
+var_dump( substr_count($str, "i", 5, 15) );
+
+/* length as Null */
+var_dump( substr_count($str, "t", "", "") );
+var_dump( substr_count($str, "i", NULL, NULL) );
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for substr_count() in %s on line %d
+NULL
+
+Notice: Undefined variable: str in %s on line %d
+
+Warning: Wrong parameter count for substr_count() in %s on line %d
+NULL
+
+Notice: Undefined variable: str in %s on line %d
+
+Warning: substr_count(): Offset should be greater than or equal to 0. in %s on line %d
+bool(false)
+
+Notice: Undefined variable: str in %s on line %d
+
+Warning: substr_count(): Offset value 25 exceeds string length. in %s on line %d
+bool(false)
+
+Notice: Undefined variable: str in %s on line %d
+
+Warning: substr_count(): Offset value 5 exceeds string length. in %s on line %d
+bool(false)
+
+Notice: Undefined variable: str in %s on line %d
+
+Warning: substr_count(): Length should be greater than 0. in %s on line %d
+bool(false)
+
+Notice: Undefined variable: str in %s on line %d
+
+Warning: substr_count(): Length should be greater than 0. in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/substr_count.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt
index f15f42508..cb6fc6bd3 100644
--- a/ext/standard/tests/strings/substr_count.phpt
+++ b/ext/standard/tests/strings/substr_count_variation_001.phpt
@@ -1,25 +1,7 @@
--TEST--
-Test substr_count() function
+Test substr_count() function (variation - 1)
--FILE--
<?php
-/* Prototype: int substr_count ( string $haystack, string $needle [, int $offset [, int $length]] );
- * Description: substr_count() returns the number of times the needle substring occurs in the
- * haystack string. Please note that needle is case sensitive
- */
-
-/* Count the number of substring occurrences */
-echo "***Testing basic operations ***\n";
-var_dump(@substr_count("", ""));
-var_dump(@substr_count("a", ""));
-var_dump(@substr_count("", "a"));
-var_dump(@substr_count("", "a"));
-var_dump(@substr_count("", chr(0)));
-$a = str_repeat("abcacba", 100);
-var_dump(@substr_count($a, "bca"));
-$a = str_repeat("abcacbabca", 100);
-var_dump(@substr_count($a, "bca"));
-var_dump(substr_count($a, "bca", 200));
-var_dump(substr_count($a, "bca", 200, 50));
echo "\n*** Testing possible variations ***\n";
echo "-- 3rd or 4th arg as string --\n";
@@ -67,43 +49,10 @@ var_dump(substr_count($str, "\0"));
var_dump(substr_count($str, "\x000"));
var_dump(substr_count($str, "0"));
-
-echo "\n*** Testing error conditions ***\n";
-/* Zero argument */
-var_dump( substr_count() );
-
-/* more than expected no. of args */
-var_dump( substr_count($str, "t", 0, 15, 30) );
-
-/* offset as negative value */
-var_dump(substr_count($str, "t", -5));
-
-/* offset > size of the string */
-var_dump(substr_count($str, "t", 25));
-
-/* Using offset and length to go beyond the size of the string:
- Warning message expected, as length+offset > length of string */
-var_dump( substr_count($str, "i", 5, 15) );
-
-/* length as Null */
-var_dump( substr_count($str, "t", "", "") );
-var_dump( substr_count($str, "i", NULL, NULL) );
-
echo "Done\n";
?>
--EXPECTF--
-***Testing basic operations ***
-bool(false)
-bool(false)
-int(0)
-int(0)
-int(0)
-int(100)
-int(200)
-int(160)
-int(10)
-
*** Testing possible variations ***
-- 3rd or 4th arg as string --
int(1)
@@ -135,27 +84,4 @@ int(16)
int(0)
int(0)
int(0)
-
-*** Testing error conditions ***
-
-Warning: Wrong parameter count for substr_count() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for substr_count() in %s on line %d
-NULL
-
-Warning: substr_count(): Offset should be greater than or equal to 0. in %s on line %d
-bool(false)
-
-Warning: substr_count(): Offset value 25 exceeds string length. in %s on line %d
-bool(false)
-
-Warning: substr_count(): Offset value 5 exceeds string length. in %s on line %d
-bool(false)
-
-Warning: substr_count(): Length should be greater than 0. in %s on line %d
-bool(false)
-
-Warning: substr_count(): Length should be greater than 0. in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/strings/substr_count_variation_002.phpt b/ext/standard/tests/strings/substr_count_variation_002.phpt
new file mode 100644
index 000000000..f8b62bd83
--- /dev/null
+++ b/ext/standard/tests/strings/substr_count_variation_002.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test substr_count() function (variation - 2)
+--FILE--
+<?php
+
+echo "\n*** Testing possible variations ***\n";
+echo "\n-- complex strings containing other than 7-bit chars --\n";
+$str = chr(128).chr(129).chr(128).chr(256).chr(255).chr(254).chr(255);
+var_dump(substr_count($str, chr(128)));
+var_dump(substr_count($str, chr(255)));
+var_dump(substr_count($str, chr(256)));
+
+echo "\n-- heredoc string --\n";
+$string = <<<EOD
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+acdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+acdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+EOD;
+var_dump(substr_count($string, "abcd"));
+var_dump(substr_count($string, "1234"));
+
+echo "\n-- heredoc null string --\n";
+$str = <<<EOD
+EOD;
+var_dump(substr_count($str, "\0"));
+var_dump(substr_count($str, "\x000"));
+var_dump(substr_count($str, "0"));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+*** Testing possible variations ***
+
+-- complex strings containing other than 7-bit chars --
+int(2)
+int(2)
+int(1)
+
+-- heredoc string --
+int(14)
+int(16)
+
+-- heredoc null string --
+int(0)
+int(0)
+int(0)
+Done
diff --git a/ext/standard/tests/strings/unpack.phpt b/ext/standard/tests/strings/unpack.phpt
new file mode 100644
index 000000000..26f3f2eaf
--- /dev/null
+++ b/ext/standard/tests/strings/unpack.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Invalid format type validation
+--FILE--
+<?php
+ var_dump(unpack("-2222", 1));
+ echo "Done\n";
+?>
+--EXPECTF--
+Warning: unpack(): Invalid format type - in %sunpack.php on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt
index 66104e3c7..c1f3b05bd 100644
--- a/ext/standard/tests/strings/wordwrap.phpt
+++ b/ext/standard/tests/strings/wordwrap.phpt
@@ -27,6 +27,8 @@ $tests = <<<TESTS
"123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1)
+FALSE === @wordwrap(chr(0), 0, "")
+
TESTS;
include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');