summaryrefslogtreecommitdiff
path: root/ext/standard/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests')
-rw-r--r--ext/standard/tests/strings/sprintf_basic1.phpt41
-rw-r--r--ext/standard/tests/strings/sprintf_basic2.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic3.phpt53
-rw-r--r--ext/standard/tests/strings/sprintf_basic4.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic5.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic6.phpt41
-rw-r--r--ext/standard/tests/strings/sprintf_basic7.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic8.phpt41
-rw-r--r--ext/standard/tests/strings/sprintf_basic9.phpt54
-rw-r--r--ext/standard/tests/strings/sprintf_error.phpt64
-rw-r--r--ext/standard/tests/strings/sprintf_variation1.phpt270
-rw-r--r--ext/standard/tests/strings/sprintf_variation10.phpt327
-rw-r--r--ext/standard/tests/strings/sprintf_variation11.phpt79
-rw-r--r--ext/standard/tests/strings/sprintf_variation12.phpt263
-rw-r--r--ext/standard/tests/strings/sprintf_variation13.phpt358
-rw-r--r--ext/standard/tests/strings/sprintf_variation14.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation15.phptbin0 -> 7416 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation16.phpt278
-rw-r--r--ext/standard/tests/strings/sprintf_variation17.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation18.phpt230
-rw-r--r--ext/standard/tests/strings/sprintf_variation19.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation2.phpt219
-rw-r--r--ext/standard/tests/strings/sprintf_variation20.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation21.phptbin0 -> 5046 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation22.phptbin0 -> 2517 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation23.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation24.phptbin0 -> 3464 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation25.phptbin0 -> 4657 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation26.phptbin0 -> 1699 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation27.phptbin0 -> 2693 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation28.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation29.phpt166
-rw-r--r--ext/standard/tests/strings/sprintf_variation3.phpt325
-rw-r--r--ext/standard/tests/strings/sprintf_variation30.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation31.phpt246
-rw-r--r--ext/standard/tests/strings/sprintf_variation32.phpt342
-rw-r--r--ext/standard/tests/strings/sprintf_variation33.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation34.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation35.phpt231
-rw-r--r--ext/standard/tests/strings/sprintf_variation36.phpt74
-rw-r--r--ext/standard/tests/strings/sprintf_variation37.phpt230
-rw-r--r--ext/standard/tests/strings/sprintf_variation38.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation39.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation4.phpt231
-rw-r--r--ext/standard/tests/strings/sprintf_variation40.phpt327
-rw-r--r--ext/standard/tests/strings/sprintf_variation41.phpt310
-rw-r--r--ext/standard/tests/strings/sprintf_variation42.phpt79
-rw-r--r--ext/standard/tests/strings/sprintf_variation43.phpt262
-rw-r--r--ext/standard/tests/strings/sprintf_variation44.phpt359
-rw-r--r--ext/standard/tests/strings/sprintf_variation45.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation46.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation47.phpt343
-rw-r--r--ext/standard/tests/strings/sprintf_variation48.phpt79
-rw-r--r--ext/standard/tests/strings/sprintf_variation49.phpt278
-rw-r--r--ext/standard/tests/strings/sprintf_variation5.phpt70
-rw-r--r--ext/standard/tests/strings/sprintf_variation50.phpt343
-rw-r--r--ext/standard/tests/strings/sprintf_variation51.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation52.phpt63
-rw-r--r--ext/standard/tests/strings/sprintf_variation53.phpt70
59 files changed, 9390 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/sprintf_basic1.phpt b/ext/standard/tests/strings/sprintf_basic1.phpt
new file mode 100644
index 0000000000..b1c6194f06
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sprintf() function : basic functionality - string format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using string format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%s";
+$format2 = "%s %s";
+$format3 = "%s %s %s";
+$arg1 = "arg1 argument";
+$arg2 = "arg2 argument";
+$arg3 = "arg3 argument";
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using string format ***
+string(6) "format"
+string(13) "arg1 argument"
+string(27) "arg1 argument arg2 argument"
+string(41) "arg1 argument arg2 argument arg3 argument"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic2.phpt b/ext/standard/tests/strings/sprintf_basic2.phpt
new file mode 100644
index 0000000000..94b177f5a3
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - integer format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using integer format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%d";
+$format2 = "%d %d";
+$format3 = "%d %d %d";
+$arg1 = 111;
+$arg2 = 222;
+$arg3 = 333;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using integer format ***
+string(6) "format"
+string(3) "111"
+string(7) "111 222"
+string(11) "111 222 333"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic3.phpt b/ext/standard/tests/strings/sprintf_basic3.phpt
new file mode 100644
index 0000000000..52582abbe1
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test sprintf() function : basic functionality - float format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using float format ***\n";
+
+
+// Initialise all required variables
+
+$format = "format";
+$format1 = "%f";
+$format2 = "%f %f";
+$format3 = "%f %f %f";
+
+$format11 = "%F";
+$format22 = "%F %F";
+$format33 = "%F %F %F";
+$arg1 = 11.11;
+$arg2 = 22.22;
+$arg3 = 33.33;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+var_dump( sprintf($format11, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+var_dump( sprintf($format22, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+var_dump( sprintf($format33, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using float format ***
+string(6) "format"
+string(9) "11.110000"
+string(9) "11.110000"
+string(19) "11.110000 22.220000"
+string(19) "11.110000 22.220000"
+string(29) "11.110000 22.220000 33.330000"
+string(29) "11.110000 22.220000 33.330000"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic4.phpt b/ext/standard/tests/strings/sprintf_basic4.phpt
new file mode 100644
index 0000000000..ee0a4b5654
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic4.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - bool format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using bool format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%b";
+$format2 = "%b %b";
+$format3 = "%b %b %b";
+$arg1 = TRUE;
+$arg2 = FALSE;
+$arg3 = true;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using bool format ***
+string(6) "format"
+string(1) "1"
+string(3) "1 0"
+string(5) "1 0 1"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic5.phpt b/ext/standard/tests/strings/sprintf_basic5.phpt
new file mode 100644
index 0000000000..7f06cbe47e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic5.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - char format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using char format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%c";
+$format2 = "%c %c";
+$format3 = "%c %c %c";
+$arg1 = 65;
+$arg2 = 66;
+$arg3 = 67;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using char format ***
+string(6) "format"
+string(1) "A"
+string(3) "A B"
+string(5) "A B C"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic6.phpt b/ext/standard/tests/strings/sprintf_basic6.phpt
new file mode 100644
index 0000000000..c6d691cec5
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic6.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sprintf() function : basic functionality - exponential format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using exponential format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%e";
+$format2 = "%E %e";
+$format3 = "%e %E %e";
+$arg1 = 1000;
+$arg2 = 2e3;
+$arg3 = +3e3;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using exponential format ***
+string(6) "format"
+string(11) "1.000000e+3"
+string(23) "1.000000E+3 2.000000e+3"
+string(35) "1.000000e+3 2.000000E+3 3.000000e+3"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic7.phpt b/ext/standard/tests/strings/sprintf_basic7.phpt
new file mode 100644
index 0000000000..4ce6044183
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic7.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - unsigned format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using unsigned format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = -1111;
+$arg2 = -1234567;
+$arg3 = +2345432;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using unsigned format ***
+string(6) "format"
+string(10) "4294966185"
+string(21) "4294966185 4293732729"
+string(29) "4294966185 4293732729 2345432"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic8.phpt b/ext/standard/tests/strings/sprintf_basic8.phpt
new file mode 100644
index 0000000000..63469e8f04
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic8.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sprintf() function : basic functionality - octal format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = 021;
+$arg2 = -0347;
+$arg3 = 05678;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using octal format ***
+string(6) "format"
+string(2) "21"
+string(14) "21 37777777431"
+string(18) "21 37777777431 567"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic9.phpt b/ext/standard/tests/strings/sprintf_basic9.phpt
new file mode 100644
index 0000000000..1e16bf810c
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic9.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test sprintf() function : basic functionality - hexadecimal format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using hexadecimal format ***\n";
+
+// Initialise all required variables
+
+// Initialising different format strings
+$format = "format";
+$format1 = "%x";
+$format2 = "%x %x";
+$format3 = "%x %x %x";
+
+$format11 = "%X";
+$format22 = "%X %X";
+$format33 = "%X %X %X";
+
+$arg1 = 11;
+$arg2 = 132;
+$arg3 = 177;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+var_dump( sprintf($format11, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+var_dump( sprintf($format22, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+var_dump( sprintf($format33, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using hexadecimal format ***
+string(6) "format"
+string(1) "b"
+string(1) "B"
+string(4) "b 84"
+string(4) "B 84"
+string(7) "b 84 b1"
+string(7) "B 84 B1"
+Done
diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt
new file mode 100644
index 0000000000..1200ab27a6
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_error.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test sprintf() function : error conditions
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing sprintf() function with Zero arguments --\n";
+var_dump( sprintf() );
+
+echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n";
+$format1 = '%s';
+$format2 = '%s%s';
+$format3 = '%s%s%s';
+$arg1 = 'one';
+$arg2 = 'two';
+
+// with one argument less than expected
+var_dump( sprintf($format1) );
+var_dump( sprintf($format2,$arg1) );
+var_dump( sprintf($format3,$arg1,$arg2) );
+
+// with two argument less than expected
+var_dump( sprintf($format2) );
+var_dump( sprintf($format3,$arg1) );
+
+// with three argument less than expected
+var_dump( sprintf($format3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : error conditions ***
+
+-- Testing sprintf() function with Zero arguments --
+
+Warning: Wrong parameter count for sprintf() in %s on line %d
+bool(false)
+
+-- Testing sprintf() function with less than expected no. of arguments --
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation1.phpt b/ext/standard/tests/strings/sprintf_variation1.phpt
new file mode 100644
index 0000000000..18553a2a52
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation1.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test sprintf() function : usage variations - unexpected values for format argument
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+* Testing sprintf() : with different unexpected values for format argument other than the strings
+*/
+
+echo "*** Testing sprintf() : with unexpected values for format argument ***\n";
+
+// initialing required variables
+$arg1 = "second arg";
+$arg2 = "third arg";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $file_handle
+);
+
+// loop through each element of the array for format
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+
+ // with default argument
+ var_dump( sprintf($value) );
+
+ // with two arguments
+ var_dump( sprintf($value, $arg1) );
+
+ // with three arguments
+ var_dump( sprintf($value, $arg1, $arg2) );
+
+ $count++;
+};
+
+// close the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with unexpected values for format argument ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "0"
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "12345"
+string(5) "12345"
+string(5) "12345"
+
+-- Iteration 4 --
+string(5) "-2345"
+string(5) "-2345"
+string(5) "-2345"
+
+-- Iteration 5 --
+string(4) "10.5"
+string(4) "10.5"
+string(4) "10.5"
+
+-- Iteration 6 --
+string(5) "-10.5"
+string(5) "-10.5"
+string(5) "-10.5"
+
+-- Iteration 7 --
+string(12) "105000000000"
+string(12) "105000000000"
+string(12) "105000000000"
+
+-- Iteration 8 --
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+string(3) "0.5"
+string(3) "0.5"
+
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 15 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 17 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 19 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 23 --
+string(6) "Object"
+string(6) "Object"
+string(6) "Object"
+
+-- Iteration 24 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 25 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 26 --
+string(14) "Resource id #5"
+string(14) "Resource id #5"
+string(14) "Resource id #5"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation10.phpt b/ext/standard/tests/strings/sprintf_variation10.phpt
new file mode 100644
index 0000000000..702dc34c77
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation10.phpt
@@ -0,0 +1,327 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with integer values ***\n";
+
+// array of int type values
+$integer_values = array (
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($integer_values as $int_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $int_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with integer values ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(9) "-1.000000"
+string(1) "f"
+string(9) "-1.000000"
+string(1) "f"
+string(10) " -1.000000"
+string(10) "-1.000000 "
+string(10) " -1.000000"
+string(10) "
+-1.000000"
+string(9) "-1.000000"
+string(30) " -1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(18) "-2147483647.000000"
+string(1) "f"
+string(18) "-2147483647.000000"
+string(1) "f"
+string(19) " -2147483647.000000"
+string(19) "-2147483647.000000 "
+string(19) " -2147483647.000000"
+string(19) "
+-2147483647.000000"
+string(18) "-2147483647.000000"
+string(30) " -2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(17) "2147483640.000000"
+string(1) "f"
+string(17) "2147483640.000000"
+string(1) "f"
+string(18) " 2147483640.000000"
+string(18) "2147483640.000000 "
+string(18) " 2147483640.000000"
+string(18) "
+2147483640.000000"
+string(17) "2147483640.000000"
+string(30) " 2147483640.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(11) "4667.000000"
+string(1) "f"
+string(11) "4667.000000"
+string(1) "f"
+string(12) " 4667.000000"
+string(12) "4667.000000 "
+string(12) " 4667.000000"
+string(12) "
+4667.000000"
+string(11) "4667.000000"
+string(30) " 4667.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(11) "4779.000000"
+string(1) "f"
+string(11) "4779.000000"
+string(1) "f"
+string(12) " 4779.000000"
+string(12) "4779.000000 "
+string(12) " 4779.000000"
+string(12) "
+4779.000000"
+string(11) "4779.000000"
+string(30) " 4779.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(11) "4095.000000"
+string(1) "f"
+string(11) "4095.000000"
+string(1) "f"
+string(12) " 4095.000000"
+string(12) "4095.000000 "
+string(12) " 4095.000000"
+string(12) "
+4095.000000"
+string(11) "4095.000000"
+string(30) " 4095.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(10) "250.000000"
+string(1) "f"
+string(10) "250.000000"
+string(1) "f"
+string(11) " 250.000000"
+string(11) "250.000000 "
+string(11) " 250.000000"
+string(11) "
+250.000000"
+string(10) "250.000000"
+string(30) " 250.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 15 --
+string(9) "83.000000"
+string(1) "f"
+string(9) "83.000000"
+string(1) "f"
+string(10) " 83.000000"
+string(10) "83.000000 "
+string(10) " 83.000000"
+string(10) "
+83.000000"
+string(9) "83.000000"
+string(30) " 83.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 16 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 17 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 18 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation11.phpt b/ext/standard/tests/strings/sprintf_variation11.phpt
new file mode 100644
index 0000000000..d15928dd9f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation11.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) " %d.000000"
+string(%d) "%d.000000 "
+string(%d) " %d.000000"
+string(%d) "
+%d.000000"
+string(%d) "%d.000000"
+string(%d) " %d.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) " %d.000000"
+string(%d) "%d.000000 "
+string(%d) " %d.000000"
+string(%d) "
+%d.000000"
+string(%d) "%d.000000"
+string(%d) " %d.000000"
+string(4) "0-9]"
+string(1) "f"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation12.phpt b/ext/standard/tests/strings/sprintf_variation12.phpt
new file mode 100644
index 0000000000..b1b186c449
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation12.phpt
@@ -0,0 +1,263 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with arrays
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with arrays ***\n";
+
+// array of array types
+$array_values = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array("123.456abc"),
+ array('123.456abc'),
+ array(1 => "One", "two" => 2)
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with arrays ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation13.phpt b/ext/standard/tests/strings/sprintf_variation13.phpt
new file mode 100644
index 0000000000..60ae89c610
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation13.phpt
@@ -0,0 +1,358 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with strings ***\n";
+
+// array of string type values
+$string_values = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+ "123.456abc",
+ "+123.456abc"
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with strings ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 15 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 16 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 17 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 18 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 19 --
+string(10) "123.456000"
+string(1) "f"
+string(10) "123.456000"
+string(1) "f"
+string(11) " 123.456000"
+string(11) "123.456000 "
+string(11) " 123.456000"
+string(11) "
+123.456000"
+string(10) "123.456000"
+string(30) " 123.456000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 20 --
+string(10) "123.456000"
+string(1) "f"
+string(10) "123.456000"
+string(1) "f"
+string(11) " 123.456000"
+string(11) "123.456000 "
+string(11) " 123.456000"
+string(11) "
+123.456000"
+string(10) "123.456000"
+string(30) " 123.456000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation14.phpt b/ext/standard/tests/strings/sprintf_variation14.phpt
new file mode 100644
index 0000000000..40704d2899
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation14.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with boolean values ***\n";
+
+// array of boolean type values
+$boolean_values = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with boolean values ***
+
+-- Iteration 1 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation15.phpt b/ext/standard/tests/strings/sprintf_variation15.phpt
new file mode 100644
index 0000000000..3769ae90d9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation15.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation16.phpt b/ext/standard/tests/strings/sprintf_variation16.phpt
new file mode 100644
index 0000000000..523eb5fb9d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation16.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with float values ***
+
+-- Iteration 1 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(10) "2147483648"
+string(1) "s"
+string(10) "2147483648"
+string(1) "s"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(11) "34359738369"
+string(1) "s"
+string(11) "34359738369"
+string(1) "s"
+string(12) " 34359738369"
+string(12) "34359738369 "
+string(12) " 34359738369"
+string(12) "
+34359738369"
+string(11) "34359738369"
+string(30) " 34359738369"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(10) "2147483649"
+string(1) "s"
+string(10) "2147483649"
+string(1) "s"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(1) "0"
+string(1) "s"
+string(1) "0"
+string(1) "s"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(4) "-0.1"
+string(1) "s"
+string(4) "-0.1"
+string(1) "s"
+string(5) " -0.1"
+string(5) "-0.1 "
+string(5) " -0.1"
+string(5) "
+-0.1"
+string(4) "-0.1"
+string(30) " -0.1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(6) "100000"
+string(1) "s"
+string(6) "100000"
+string(1) "s"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(8) "-1000000"
+string(1) "s"
+string(8) "-1000000"
+string(1) "s"
+string(9) " -1000000"
+string(9) "-1000000 "
+string(9) " -1000000"
+string(9) "
+-1000000"
+string(8) "-1000000"
+string(30) " -1000000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(9) "100000000"
+string(1) "s"
+string(9) "100000000"
+string(1) "s"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 13 --
+string(11) "-1000000000"
+string(1) "s"
+string(11) "-1000000000"
+string(1) "s"
+string(12) " -1000000000"
+string(12) "-1000000000 "
+string(12) " -1000000000"
+string(12) "
+-1000000000"
+string(11) "-1000000000"
+string(30) " -1000000000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 14 --
+string(2) "10"
+string(1) "s"
+string(2) "10"
+string(1) "s"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 15 --
+string(7) "1050000"
+string(1) "s"
+string(7) "1050000"
+string(1) "s"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation17.phpt b/ext/standard/tests/strings/sprintf_variation17.phpt
new file mode 100644
index 0000000000..08028f8fe1
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation17.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource values
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) " Resource id #%d"
+string(%d) "Resource id #%d "
+string(%d) " Resource id #%d"
+string(%d) "
+Resource id #%d"
+string(%d) "Resource id #%d"
+string(%d) " Resource id #%d"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) " Resource id #%d"
+string(%d) "Resource id #%d "
+string(%d) " Resource id #%d"
+string(%d) "
+Resource id #%d"
+string(%d) "Resource id #%d"
+string(%d) " Resource id #%d"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation18.phpt b/ext/standard/tests/strings/sprintf_variation18.phpt
new file mode 100644
index 0000000000..b0013a4e9d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation18.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with array values ***\n";
+
+// different arrays used to test he function
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with array values ***
+
+-- Iteration 1 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation19.phpt b/ext/standard/tests/strings/sprintf_variation19.phpt
new file mode 100644
index 0000000000..ae7b910573
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation19.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "s"
+string(1) "0"
+string(1) "s"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(2) "-1"
+string(1) "s"
+string(2) "-1"
+string(1) "s"
+string(3) " -1"
+string(3) "-1 "
+string(3) " -1"
+string(3) "
+-1"
+string(4) " -1"
+string(30) " -1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(11) "-2147483647"
+string(1) "s"
+string(11) "-2147483647"
+string(1) "s"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "s"
+string(10) "2147483640"
+string(1) "s"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "s"
+string(4) "4667"
+string(1) "s"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "s"
+string(4) "4779"
+string(1) "s"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "s"
+string(4) "4095"
+string(1) "s"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "s"
+string(3) "250"
+string(1) "s"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "s"
+string(2) "83"
+string(1) "s"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 17 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation2.phpt b/ext/standard/tests/strings/sprintf_variation2.phpt
new file mode 100644
index 0000000000..cc3547ae6e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation2.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test sprintf() function : usage variations - with all types of values for arg1 argument
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : with different types of values passed for arg1 argument ***\n";
+
+// initialing required variables
+$format = '%s';
+$arg2 = 'third argument';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $file_handle
+);
+
+// loop through each element of the array for arg1
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+
+ // with two arguments
+ var_dump( sprintf($format, $value) );
+
+ // with three arguments
+ var_dump( sprintf($format, $value, $arg2) );
+
+ $count++;
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with different types of values passed for arg1 argument ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "12345"
+string(5) "12345"
+
+-- Iteration 4 --
+string(5) "-2345"
+string(5) "-2345"
+
+-- Iteration 5 --
+string(4) "10.5"
+string(4) "10.5"
+
+-- Iteration 6 --
+string(5) "-10.5"
+string(5) "-10.5"
+
+-- Iteration 7 --
+string(12) "105000000000"
+string(12) "105000000000"
+
+-- Iteration 8 --
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+string(3) "0.5"
+
+-- Iteration 10 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 11 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 12 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 13 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 14 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 15 --
+string(0) ""
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+
+-- Iteration 17 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+
+-- Iteration 19 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+
+-- Iteration 23 --
+string(6) "string"
+string(6) "string"
+
+-- Iteration 24 --
+string(6) "string"
+string(6) "string"
+
+-- Iteration 25 --
+string(6) "Object"
+string(6) "Object"
+
+-- Iteration 26 --
+string(0) ""
+string(0) ""
+
+-- Iteration 27 --
+string(0) ""
+string(0) ""
+
+-- Iteration 28 --
+string(14) "Resource id #%d"
+string(14) "Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation20.phpt b/ext/standard/tests/strings/sprintf_variation20.phpt
new file mode 100644
index 0000000000..fc82fefa2a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation20.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(0) ""
+string(1) "s"
+string(0) ""
+string(1) "s"
+string(1) " "
+string(1) " "
+string(1) " "
+string(1) "
+"
+string(4) " "
+string(30) " "
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(0) ""
+string(1) "s"
+string(0) ""
+string(1) "s"
+string(1) " "
+string(1) " "
+string(1) " "
+string(1) "
+"
+string(4) " "
+string(30) " "
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation21.phpt b/ext/standard/tests/strings/sprintf_variation21.phpt
new file mode 100644
index 0000000000..afedfcaf7c
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation21.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation22.phpt b/ext/standard/tests/strings/sprintf_variation22.phpt
new file mode 100644
index 0000000000..8684765250
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation22.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation23.phpt b/ext/standard/tests/strings/sprintf_variation23.phpt
new file mode 100644
index 0000000000..bf88ba68ce
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation23.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - char formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : char formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of char formats
+$char_formats = array(
+ "%c", "%hc", "%lc",
+ "%Lc", " %c", "%c ",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-bA-B@#$&]", "%*c"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($char_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : char formats with resource values ***
+
+-- Iteration 1 --
+string(1) ""
+string(1) "c"
+string(1) ""
+string(1) "c"
+string(2) " "
+string(2) " "
+string(2) " "
+string(2) "
+"
+string(1) ""
+string(1) ""
+string(11) "a-bA-B@#$&]"
+string(1) "c"
+
+-- Iteration 2 --
+string(1) ""
+string(1) "c"
+string(1) ""
+string(1) "c"
+string(2) " "
+string(2) " "
+string(2) " "
+string(2) "
+"
+string(1) ""
+string(1) ""
+string(11) "a-bA-B@#$&]"
+string(1) "c"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation24.phpt b/ext/standard/tests/strings/sprintf_variation24.phpt
new file mode 100644
index 0000000000..6bb3e0e370
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation24.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation25.phpt b/ext/standard/tests/strings/sprintf_variation25.phpt
new file mode 100644
index 0000000000..456344c3f0
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation25.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation26.phpt b/ext/standard/tests/strings/sprintf_variation26.phpt
new file mode 100644
index 0000000000..b5881ea5ea
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation26.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation27.phpt b/ext/standard/tests/strings/sprintf_variation27.phpt
new file mode 100644
index 0000000000..88602dbdb2
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation27.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation28.phpt b/ext/standard/tests/strings/sprintf_variation28.phpt
new file mode 100644
index 0000000000..08237f9289
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation28.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(11) "37777777777"
+string(1) "o"
+string(11) "37777777777"
+string(1) "o"
+string(12) " 37777777777"
+string(12) "37777777777 "
+string(12) " 37777777777"
+string(12) "
+37777777777"
+string(11) "37777777777"
+string(30) " 37777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(11) "20000000001"
+string(1) "o"
+string(11) "20000000001"
+string(1) "o"
+string(12) " 20000000001"
+string(12) "20000000001 "
+string(12) " 20000000001"
+string(12) "
+20000000001"
+string(11) "20000000001"
+string(30) " 20000000001"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(11) "17777777770"
+string(1) "o"
+string(11) "17777777770"
+string(1) "o"
+string(12) " 17777777770"
+string(12) "17777777770 "
+string(12) " 17777777770"
+string(12) "
+17777777770"
+string(11) "17777777770"
+string(30) " 17777777770"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(5) "11073"
+string(1) "o"
+string(5) "11073"
+string(1) "o"
+string(6) " 11073"
+string(6) "11073 "
+string(6) " 11073"
+string(6) "
+11073"
+string(5) "11073"
+string(30) " 11073"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(5) "11253"
+string(1) "o"
+string(5) "11253"
+string(1) "o"
+string(6) " 11253"
+string(6) "11253 "
+string(6) " 11253"
+string(6) "
+11253"
+string(5) "11253"
+string(30) " 11253"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(4) "7777"
+string(1) "o"
+string(4) "7777"
+string(1) "o"
+string(5) " 7777"
+string(5) "7777 "
+string(5) " 7777"
+string(5) "
+7777"
+string(4) "7777"
+string(30) " 7777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(3) "372"
+string(1) "o"
+string(3) "372"
+string(1) "o"
+string(4) " 372"
+string(4) "372 "
+string(4) " 372"
+string(4) "
+372"
+string(4) " 372"
+string(30) " 372"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 14 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 15 --
+string(3) "123"
+string(1) "o"
+string(3) "123"
+string(1) "o"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 17 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 18 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation29.phpt b/ext/standard/tests/strings/sprintf_variation29.phpt
new file mode 100644
index 0000000000..271c6a9052
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation29.phpt
@@ -0,0 +1,166 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.5e+5
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with float values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(6) "303240"
+string(1) "o"
+string(6) "303240"
+string(1) "o"
+string(7) " 303240"
+string(7) "303240 "
+string(7) " 303240"
+string(7) "
+303240"
+string(6) "303240"
+string(30) " 303240"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(11) "37774136700"
+string(1) "o"
+string(11) "37774136700"
+string(1) "o"
+string(12) " 37774136700"
+string(12) "37774136700 "
+string(12) " 37774136700"
+string(12) "
+37774136700"
+string(11) "37774136700"
+string(30) " 37774136700"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(9) "575360400"
+string(1) "o"
+string(9) "575360400"
+string(1) "o"
+string(10) " 575360400"
+string(10) "575360400 "
+string(10) " 575360400"
+string(10) "
+575360400"
+string(9) "575360400"
+string(30) " 575360400"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(11) "30431233000"
+string(1) "o"
+string(11) "30431233000"
+string(1) "o"
+string(12) " 30431233000"
+string(12) "30431233000 "
+string(12) " 30431233000"
+string(12) "
+30431233000"
+string(11) "30431233000"
+string(30) " 30431233000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(7) "4002620"
+string(1) "o"
+string(7) "4002620"
+string(1) "o"
+string(8) " 4002620"
+string(8) "4002620 "
+string(8) " 4002620"
+string(8) "
+4002620"
+string(7) "4002620"
+string(30) " 4002620"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation3.phpt b/ext/standard/tests/strings/sprintf_variation3.phpt
new file mode 100644
index 0000000000..51a89ea08b
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation3.phpt
@@ -0,0 +1,325 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with int values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with integer values ***\n";
+
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($valid_ints as $int_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $int_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(2) "-1"
+string(1) "d"
+string(2) "-1"
+string(1) "d"
+string(3) " -1"
+string(3) "-1 "
+string(3) " -1"
+string(3) "
+-1"
+string(4) " -1"
+string(30) " -1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(11) "-2147483647"
+string(1) "d"
+string(11) "-2147483647"
+string(1) "d"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "d"
+string(10) "2147483640"
+string(1) "d"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "d"
+string(4) "4667"
+string(1) "d"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "d"
+string(4) "4779"
+string(1) "d"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "d"
+string(4) "4095"
+string(1) "d"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "d"
+string(3) "250"
+string(1) "d"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "d"
+string(2) "83"
+string(1) "d"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 17 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation30.phpt b/ext/standard/tests/strings/sprintf_variation30.phpt
new file mode 100644
index 0000000000..57c5abbd86
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation30.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "o"
+string(%d) "%d"
+string(1) "o"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "o"
+string(%d) "%d"
+string(1) "o"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation31.phpt b/ext/standard/tests/strings/sprintf_variation31.phpt
new file mode 100644
index 0000000000..a081273a22
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation31.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with array values ***\n";
+
+// different arrays used to test the function
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(0123),
+ array(1 => "One", "two" => 2)
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation32.phpt b/ext/standard/tests/strings/sprintf_variation32.phpt
new file mode 100644
index 0000000000..6caf8ee6a3
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation32.phpt
@@ -0,0 +1,342 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "0123",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(3) "173"
+string(1) "o"
+string(3) "173"
+string(1) "o"
+string(4) " 173"
+string(4) "173 "
+string(4) " 173"
+string(4) "
+173"
+string(4) " 173"
+string(30) " 173"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation33.phpt b/ext/standard/tests/strings/sprintf_variation33.phpt
new file mode 100644
index 0000000000..e903108f9e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation33.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation34.phpt b/ext/standard/tests/strings/sprintf_variation34.phpt
new file mode 100644
index 0000000000..51443d8e6a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation34.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(8) "ffffffff"
+string(9) "ffffffffx"
+string(8) "ffffffff"
+string(1) "x"
+string(9) " ffffffff"
+string(9) "ffffffff "
+string(9) " ffffffff"
+string(9) "
+ffffffff"
+string(8) "ffffffff"
+string(30) " ffffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(8) "80000001"
+string(9) "80000001x"
+string(8) "80000001"
+string(1) "x"
+string(9) " 80000001"
+string(9) "80000001 "
+string(9) " 80000001"
+string(9) "
+80000001"
+string(8) "80000001"
+string(30) " 80000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(8) "7ffffff8"
+string(9) "7ffffff8x"
+string(8) "7ffffff8"
+string(1) "x"
+string(9) " 7ffffff8"
+string(9) "7ffffff8 "
+string(9) " 7ffffff8"
+string(9) "
+7ffffff8"
+string(8) "7ffffff8"
+string(30) " 7ffffff8"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(4) "123b"
+string(5) "123bx"
+string(4) "123b"
+string(1) "x"
+string(5) " 123b"
+string(5) "123b "
+string(5) " 123b"
+string(5) "
+123b"
+string(4) "123b"
+string(30) " 123b"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(4) "12ab"
+string(5) "12abx"
+string(4) "12ab"
+string(1) "x"
+string(5) " 12ab"
+string(5) "12ab "
+string(5) " 12ab"
+string(5) "
+12ab"
+string(4) "12ab"
+string(30) " 12ab"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(3) "fff"
+string(4) "fffx"
+string(3) "fff"
+string(1) "x"
+string(4) " fff"
+string(4) "fff "
+string(4) " fff"
+string(4) "
+fff"
+string(4) " fff"
+string(30) " fff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(2) "fa"
+string(3) "fax"
+string(2) "fa"
+string(1) "x"
+string(3) " fa"
+string(3) "fa "
+string(3) " fa"
+string(3) "
+fa"
+string(4) " fa"
+string(30) " fa"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 13 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 14 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 15 --
+string(2) "53"
+string(3) "53x"
+string(2) "53"
+string(1) "x"
+string(3) " 53"
+string(3) "53 "
+string(3) " 53"
+string(3) "
+53"
+string(4) " 53"
+string(30) " 53"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 16 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 17 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 18 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation35.phpt b/ext/standard/tests/strings/sprintf_variation35.phpt
new file mode 100644
index 0000000000..c8f03cd05f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation35.phpt
@@ -0,0 +1,231 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 2147483647,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with float values ***
+
+-- Iteration 1 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(8) "80000001"
+string(9) "80000001x"
+string(8) "80000001"
+string(1) "x"
+string(9) " 80000001"
+string(9) "80000001 "
+string(9) " 80000001"
+string(9) "
+80000001"
+string(8) "80000001"
+string(30) " 80000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(5) "186a0"
+string(6) "186a0x"
+string(5) "186a0"
+string(1) "x"
+string(6) " 186a0"
+string(6) "186a0 "
+string(6) " 186a0"
+string(6) "
+186a0"
+string(5) "186a0"
+string(30) " 186a0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(8) "fff0bdc0"
+string(9) "fff0bdc0x"
+string(8) "fff0bdc0"
+string(1) "x"
+string(9) " fff0bdc0"
+string(9) "fff0bdc0 "
+string(9) " fff0bdc0"
+string(9) "
+fff0bdc0"
+string(8) "fff0bdc0"
+string(30) " fff0bdc0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(7) "5f5e100"
+string(8) "5f5e100x"
+string(7) "5f5e100"
+string(1) "x"
+string(8) " 5f5e100"
+string(8) "5f5e100 "
+string(8) " 5f5e100"
+string(8) "
+5f5e100"
+string(7) "5f5e100"
+string(30) " 5f5e100"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(8) "c4653600"
+string(9) "c4653600x"
+string(8) "c4653600"
+string(1) "x"
+string(9) " c4653600"
+string(9) "c4653600 "
+string(9) " c4653600"
+string(9) "
+c4653600"
+string(8) "c4653600"
+string(30) " c4653600"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "a"
+string(2) "ax"
+string(1) "a"
+string(1) "x"
+string(2) " a"
+string(2) "a "
+string(2) " a"
+string(2) "
+a"
+string(4) " a"
+string(30) " a"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(6) "100590"
+string(7) "100590x"
+string(6) "100590"
+string(1) "x"
+string(7) " 100590"
+string(7) "100590 "
+string(7) " 100590"
+string(7) "
+100590"
+string(6) "100590"
+string(30) " 100590"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation36.phpt b/ext/standard/tests/strings/sprintf_variation36.phpt
new file mode 100644
index 0000000000..b7b16d7d99
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation36.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(%d) "%dx"
+string(%d) "%d"
+string(1) "x"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(%d) "%dx"
+string(%d) "%d"
+string(1) "x"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation37.phpt b/ext/standard/tests/strings/sprintf_variation37.phpt
new file mode 100644
index 0000000000..d1ecbfc0dc
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation37.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation38.phpt b/ext/standard/tests/strings/sprintf_variation38.phpt
new file mode 100644
index 0000000000..f9b4a7f6ab
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation38.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 13 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 14 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 15 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 16 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 17 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 18 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation39.phpt b/ext/standard/tests/strings/sprintf_variation39.phpt
new file mode 100644
index 0000000000..dac4346176
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation39.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation4.phpt b/ext/standard/tests/strings/sprintf_variation4.phpt
new file mode 100644
index 0000000000..3c8fab39b1
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation4.phpt
@@ -0,0 +1,231 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with float values ***\n";
+
+// array of float type values
+
+$float_values = array (
+ 2147483648,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with float values ***
+
+-- Iteration 1 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(11) "-2147483647"
+string(1) "d"
+string(11) "-2147483647"
+string(1) "d"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(6) "100000"
+string(1) "d"
+string(6) "100000"
+string(1) "d"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(8) "-1000000"
+string(1) "d"
+string(8) "-1000000"
+string(1) "d"
+string(9) " -1000000"
+string(9) "-1000000 "
+string(9) " -1000000"
+string(9) "
+-1000000"
+string(8) "-1000000"
+string(30) " -1000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(9) "100000000"
+string(1) "d"
+string(9) "100000000"
+string(1) "d"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(11) "-1000000000"
+string(1) "d"
+string(11) "-1000000000"
+string(1) "d"
+string(12) " -1000000000"
+string(12) "-1000000000 "
+string(12) " -1000000000"
+string(12) "
+-1000000000"
+string(11) "-1000000000"
+string(30) " -1000000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(2) "10"
+string(1) "d"
+string(2) "10"
+string(1) "d"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(7) "1050000"
+string(1) "d"
+string(7) "1050000"
+string(1) "d"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation40.phpt b/ext/standard/tests/strings/sprintf_variation40.phpt
new file mode 100644
index 0000000000..9c17e6c766
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation40.phpt
@@ -0,0 +1,327 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ +2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(10) "4294967295"
+string(1) "u"
+string(10) "4294967295"
+string(1) "u"
+string(11) " 4294967295"
+string(11) "4294967295 "
+string(11) " 4294967295"
+string(11) "
+4294967295"
+string(10) "4294967295"
+string(30) " 4294967295"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(10) "2147483649"
+string(1) "u"
+string(10) "2147483649"
+string(1) "u"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "u"
+string(10) "2147483640"
+string(1) "u"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "u"
+string(4) "4667"
+string(1) "u"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "u"
+string(4) "4779"
+string(1) "u"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "u"
+string(4) "4095"
+string(1) "u"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "u"
+string(3) "250"
+string(1) "u"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "u"
+string(2) "83"
+string(1) "u"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation41.phpt b/ext/standard/tests/strings/sprintf_variation41.phpt
new file mode 100644
index 0000000000..481712d0fa
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation41.phpt
@@ -0,0 +1,310 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 2147483647,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ +1e5,
+ +5e+5,
+ +0e-5,
+ -1e5,
+ -1e+5,
+ -1e-2,
+ 1e5,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with float values ***
+
+-- Iteration 1 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(10) "2147483649"
+string(1) "u"
+string(10) "2147483649"
+string(1) "u"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(6) "100000"
+string(1) "u"
+string(6) "100000"
+string(1) "u"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(6) "500000"
+string(1) "u"
+string(6) "500000"
+string(1) "u"
+string(7) " 500000"
+string(7) "500000 "
+string(7) " 500000"
+string(7) "
+500000"
+string(6) "500000"
+string(30) " 500000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(10) "4294867296"
+string(1) "u"
+string(10) "4294867296"
+string(1) "u"
+string(11) " 4294867296"
+string(11) "4294867296 "
+string(11) " 4294867296"
+string(11) "
+4294867296"
+string(10) "4294867296"
+string(30) " 4294867296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(10) "4294867296"
+string(1) "u"
+string(10) "4294867296"
+string(1) "u"
+string(11) " 4294867296"
+string(11) "4294867296 "
+string(11) " 4294867296"
+string(11) "
+4294867296"
+string(10) "4294867296"
+string(30) " 4294867296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(6) "100000"
+string(1) "u"
+string(6) "100000"
+string(1) "u"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(9) "100000000"
+string(1) "u"
+string(9) "100000000"
+string(1) "u"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(10) "3294967296"
+string(1) "u"
+string(10) "3294967296"
+string(1) "u"
+string(11) " 3294967296"
+string(11) "3294967296 "
+string(11) " 3294967296"
+string(11) "
+3294967296"
+string(10) "3294967296"
+string(30) " 3294967296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(2) "10"
+string(1) "u"
+string(2) "10"
+string(1) "u"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(7) "1050000"
+string(1) "u"
+string(7) "1050000"
+string(1) "u"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation42.phpt b/ext/standard/tests/strings/sprintf_variation42.phpt
new file mode 100644
index 0000000000..a1c01ff6b3
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation42.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "u"
+string(%d) "%d"
+string(1) "u"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "u"
+string(%d) "%d"
+string(1) "u"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation43.phpt b/ext/standard/tests/strings/sprintf_variation43.phpt
new file mode 100644
index 0000000000..86527a52d4
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation43.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(-12345),
+ array(+12345),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation44.phpt b/ext/standard/tests/strings/sprintf_variation44.phpt
new file mode 100644
index 0000000000..6659d40301
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation44.phpt
@@ -0,0 +1,359 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "-123",
+ "+123",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(10) "4294967173"
+string(1) "u"
+string(10) "4294967173"
+string(1) "u"
+string(11) " 4294967173"
+string(11) "4294967173 "
+string(11) " 4294967173"
+string(11) "
+4294967173"
+string(10) "4294967173"
+string(30) " 4294967173"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(3) "123"
+string(1) "u"
+string(3) "123"
+string(1) "u"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 20 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation45.phpt b/ext/standard/tests/strings/sprintf_variation45.phpt
new file mode 100644
index 0000000000..e8219fc95e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation45.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation46.phpt b/ext/standard/tests/strings/sprintf_variation46.phpt
new file mode 100644
index 0000000000..36aef14dd8
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation46.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with integer values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(12) "-1.000000e+0"
+string(1) "e"
+string(12) "-1.000000e+0"
+string(1) "e"
+string(13) " -1.000000e+0"
+string(13) "-1.000000e+0 "
+string(13) " -1.000000e+0"
+string(13) "
+-1.000000e+0"
+string(12) "-1.000000e+0"
+string(30) " -1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "4.667000e+3"
+string(1) "e"
+string(11) "4.667000e+3"
+string(1) "e"
+string(12) " 4.667000e+3"
+string(12) "4.667000e+3 "
+string(12) " 4.667000e+3"
+string(12) "
+4.667000e+3"
+string(11) "4.667000e+3"
+string(30) " 4.667000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "4.779000e+3"
+string(1) "e"
+string(11) "4.779000e+3"
+string(1) "e"
+string(12) " 4.779000e+3"
+string(12) "4.779000e+3 "
+string(12) " 4.779000e+3"
+string(12) "
+4.779000e+3"
+string(11) "4.779000e+3"
+string(30) " 4.779000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "4.095000e+3"
+string(1) "e"
+string(11) "4.095000e+3"
+string(1) "e"
+string(12) " 4.095000e+3"
+string(12) "4.095000e+3 "
+string(12) " 4.095000e+3"
+string(12) "
+4.095000e+3"
+string(11) "4.095000e+3"
+string(30) " 4.095000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "2.500000e+2"
+string(1) "e"
+string(11) "2.500000e+2"
+string(1) "e"
+string(12) " 2.500000e+2"
+string(12) "2.500000e+2 "
+string(12) " 2.500000e+2"
+string(12) "
+2.500000e+2"
+string(11) "2.500000e+2"
+string(30) " 2.500000e+2"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "8.300000e+1"
+string(1) "e"
+string(11) "8.300000e+1"
+string(1) "e"
+string(12) " 8.300000e+1"
+string(12) "8.300000e+1 "
+string(12) " 8.300000e+1"
+string(12) "
+8.300000e+1"
+string(11) "8.300000e+1"
+string(30) " 8.300000e+1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation47.phpt b/ext/standard/tests/strings/sprintf_variation47.phpt
new file mode 100644
index 0000000000..4a100ef7dc
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation47.phpt
@@ -0,0 +1,343 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e5,
+ -1e5,
+ +1e5,
+ 1e+5,
+ -1e-5,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with float values ***
+
+-- Iteration 1 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(12) "3.435974e+10"
+string(1) "e"
+string(12) "3.435974e+10"
+string(1) "e"
+string(13) " 3.435974e+10"
+string(13) "3.435974e+10 "
+string(13) " 3.435974e+10"
+string(13) "
+3.435974e+10"
+string(12) "3.435974e+10"
+string(30) " 3.435974e+10"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(12) "-1.000000e-1"
+string(1) "e"
+string(12) "-1.000000e-1"
+string(1) "e"
+string(13) " -1.000000e-1"
+string(13) "-1.000000e-1 "
+string(13) " -1.000000e-1"
+string(13) "
+-1.000000e-1"
+string(12) "-1.000000e-1"
+string(30) " -1.000000e-1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(12) "-1.000000e+5"
+string(1) "e"
+string(12) "-1.000000e+5"
+string(1) "e"
+string(13) " -1.000000e+5"
+string(13) "-1.000000e+5 "
+string(13) " -1.000000e+5"
+string(13) "
+-1.000000e+5"
+string(12) "-1.000000e+5"
+string(30) " -1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(12) "-1.000000e+5"
+string(1) "e"
+string(12) "-1.000000e+5"
+string(1) "e"
+string(13) " -1.000000e+5"
+string(13) "-1.000000e+5 "
+string(13) " -1.000000e+5"
+string(13) "
+-1.000000e+5"
+string(12) "-1.000000e+5"
+string(30) " -1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(12) "-1.000000e-5"
+string(1) "e"
+string(12) "-1.000000e-5"
+string(1) "e"
+string(13) " -1.000000e-5"
+string(13) "-1.000000e-5 "
+string(13) " -1.000000e-5"
+string(13) "
+-1.000000e-5"
+string(12) "-1.000000e-5"
+string(30) " -1.000000e-5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "1.000000e+8"
+string(1) "e"
+string(11) "1.000000e+8"
+string(1) "e"
+string(12) " 1.000000e+8"
+string(12) "1.000000e+8 "
+string(12) " 1.000000e+8"
+string(12) "
+1.000000e+8"
+string(11) "1.000000e+8"
+string(30) " 1.000000e+8"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(12) "-1.000000e+9"
+string(1) "e"
+string(12) "-1.000000e+9"
+string(1) "e"
+string(13) " -1.000000e+9"
+string(13) "-1.000000e+9 "
+string(13) " -1.000000e+9"
+string(13) "
+-1.000000e+9"
+string(12) "-1.000000e+9"
+string(30) " -1.000000e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "1.000000e+1"
+string(1) "e"
+string(11) "1.000000e+1"
+string(1) "e"
+string(12) " 1.000000e+1"
+string(12) "1.000000e+1 "
+string(12) " 1.000000e+1"
+string(12) "
+1.000000e+1"
+string(11) "1.000000e+1"
+string(30) " 1.000000e+1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 19 --
+string(11) "1.050000e+6"
+string(1) "e"
+string(11) "1.050000e+6"
+string(1) "e"
+string(12) " 1.050000e+6"
+string(12) "1.050000e+6 "
+string(12) " 1.050000e+6"
+string(12) "
+1.050000e+6"
+string(11) "1.050000e+6"
+string(30) " 1.050000e+6"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation48.phpt b/ext/standard/tests/strings/sprintf_variation48.phpt
new file mode 100644
index 0000000000..df28784eb2
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation48.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d.000000e+0"
+string(1) "e"
+string(%d) "%d.000000e+0"
+string(1) "e"
+string(%d) " %d.000000e+0"
+string(%d) "%d.000000e+0 "
+string(%d) " %d.000000e+0"
+string(%d) "
+%d.000000e+0"
+string(%d) "%d.000000e+0"
+string(%d) " %d.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(%d) "%d.000000e+0"
+string(1) "e"
+string(%d) "%d.000000e+0"
+string(1) "e"
+string(%d) " %d.000000e+0"
+string(%d) "%d.000000e+0 "
+string(%d) " %d.000000e+0"
+string(%d) "
+%d.000000e+0"
+string(%d) "%d.000000e+0"
+string(%d) " %d.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation49.phpt b/ext/standard/tests/strings/sprintf_variation49.phpt
new file mode 100644
index 0000000000..554b43ac1e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation49.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(100000000000),
+ array(.0000001),
+ array(10e2),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with array values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation5.phpt b/ext/standard/tests/strings/sprintf_variation5.phpt
new file mode 100644
index 0000000000..b703d749fb
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation5.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%Ld", " %d",
+ "\t%d", "\n%d", "%4d",
+ "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($resource_types as $res) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $res) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "d"
+string(%d) " %d"
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "d"
+string(%d) " %d"
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(4) "0-9]"
+string(1) "d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation50.phpt b/ext/standard/tests/strings/sprintf_variation50.phpt
new file mode 100644
index 0000000000..62bae0e22a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation50.phpt
@@ -0,0 +1,343 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+ "333333333333333333333333333333"
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with string values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 19 --
+string(12) "3.333333e+29"
+string(1) "e"
+string(12) "3.333333e+29"
+string(1) "e"
+string(13) " 3.333333e+29"
+string(13) "3.333333e+29 "
+string(13) " 3.333333e+29"
+string(13) "
+3.333333e+29"
+string(12) "3.333333e+29"
+string(30) " 3.333333e+29"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation51.phpt b/ext/standard/tests/strings/sprintf_variation51.phpt
new file mode 100644
index 0000000000..d988aa70ef
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation51.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with boolean values ***
+
+-- Iteration 1 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation52.phpt b/ext/standard/tests/strings/sprintf_variation52.phpt
new file mode 100644
index 0000000000..9ca598527a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation52.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test sprintf() function : usage variations - typical format strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : with typical format strings ***\n";
+
+// initialising required variables
+$tempnum = 12345;
+$tempstring = "abcdefghjklmnpqrstuvwxyz";
+
+echo"\n-- Testing for '%%%.2f' as the format parameter --\n";
+var_dump(sprintf("%%%.2f", 1.23456789e10));
+
+echo"\n-- Testing for '%%' as the format parameter --\n";
+var_dump(sprintf("%%", 1.23456789e10));
+
+echo"\n-- Testing for precision value more than maximum --\n";
+var_dump(sprintf("%.988f", 1.23456789e10));
+
+echo"\n-- Testing for invalid width(-15) specifier --\n";
+var_dump(sprintf("%030.-15s", $tempstring));
+
+echo"\n-- Testing for '%X' as the format parameter --\n";
+var_dump(sprintf("%X", 12));
+
+echo"\n-- Testing for multiple format parameters --\n";
+var_dump(sprintf("%d %s %d\n", $tempnum, $tempstring, $tempnum));
+
+echo"\n-- Testing for excess of mixed type arguments --\n";
+var_dump(sprintf("%s", $tempstring, $tempstring, $tempstring));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with typical format strings ***
+
+-- Testing for '%%%.2f' as the format parameter --
+string(15) "%12345678900.00"
+
+-- Testing for '%%' as the format parameter --
+string(1) "%"
+
+-- Testing for precision value more than maximum --
+string(52) "12345678900.0000000000000000000000000000000000000000"
+
+-- Testing for invalid width(-15) specifier --
+string(3) "15s"
+
+-- Testing for '%X' as the format parameter --
+string(1) "C"
+
+-- Testing for multiple format parameters --
+string(39) "12345 abcdefghjklmnpqrstuvwxyz 12345
+"
+
+-- Testing for excess of mixed type arguments --
+string(24) "abcdefghjklmnpqrstuvwxyz"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation53.phpt b/ext/standard/tests/strings/sprintf_variation53.phpt
new file mode 100644
index 0000000000..427d0d9364
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation53.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test sprintf() function : usage variations - with whitespaces in format strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d", "% d", "% d",
+ "% f", "% f", "% f",
+ "% F", "% F", "% F",
+ "% b", "% b", "% b",
+ "% c", "% c", "% c",
+ "% e", "% e", "% e",
+ "% u", "% u", "% u",
+ "% o", "% o", "% o",
+ "% x", "% x", "% x",
+ "% X", "% X", "% X",
+ "% E", "% E", "% E"
+);
+
+// initializing the args array
+
+foreach($formats as $format) {
+ var_dump( sprintf($format, 1234) );
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with white spaces in format strings ***
+string(4) "1234"
+string(4) "1234"
+string(4) "1234"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "10011010010"
+string(11) "10011010010"
+string(11) "10011010010"
+string(1) "Ò"
+string(1) "Ò"
+string(1) "Ò"
+string(11) "1.234000e+3"
+string(11) "1.234000e+3"
+string(11) "1.234000e+3"
+string(4) "1234"
+string(4) "1234"
+string(4) "1234"
+string(4) "2322"
+string(4) "2322"
+string(4) "2322"
+string(3) "4d2"
+string(3) "4d2"
+string(3) "4d2"
+string(3) "4D2"
+string(3) "4D2"
+string(3) "4D2"
+string(11) "1.234000E+3"
+string(11) "1.234000E+3"
+string(11) "1.234000E+3"
+Done \ No newline at end of file