]> granicus.if.org Git - php/commitdiff
New testcases for strtr() function
authorRaghubansh Kumar <kraghuba@php.net>
Mon, 8 Oct 2007 15:31:06 +0000 (15:31 +0000)
committerRaghubansh Kumar <kraghuba@php.net>
Mon, 8 Oct 2007 15:31:06 +0000 (15:31 +0000)
ext/standard/tests/strings/strtr_basic.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_error.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation1.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation2.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation3.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation4.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation5.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation6.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation7.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation8.phpt [new file with mode: 0644]
ext/standard/tests/strings/strtr_variation9.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/strings/strtr_basic.phpt b/ext/standard/tests/strings/strtr_basic.phpt
new file mode 100644 (file)
index 0000000..7ece869
--- /dev/null
@@ -0,0 +1,69 @@
+--TEST--
+Test strtr() function : basic functionality
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+ * Description: Translates characters in str using given translation pairs
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strtr() : basic functionality ***\n";
+//definitions of required input variables
+$trans1_arr = array("t" => "T", "e" => "E", "st" => "ST");
+$trans2_arr = array('t' => 'T', 'e' => 'E', 'st' => 'ST');
+$heredoc_str = <<<EOD
+test strtr
+EOD;
+
+//translating single char
+var_dump( strtr("test strtr", "t", "T") );
+var_dump( strtr('test strtr', 't', 'T') );
+var_dump( strtr($heredoc_str, "t", "T") );
+
+//translating set of chars
+//$from and $to are of same length
+var_dump( strtr(b"test strtr", b"test", b"TEST") );
+var_dump( strtr('test strtr', 'test', 'TEST') );
+var_dump( strtr($heredoc_str, "test", "TEST") );
+
+//$from and $to are of different lengths, extra chars in the longer one are ignored
+var_dump( strtr("test strtr", "test", "TESTz") ); 
+var_dump( strtr('test strtr', 'testz', 'TEST') );
+var_dump( strtr($heredoc_str, "test", "TESTz") );
+
+//by using replace_pairs array
+var_dump( strtr("test strtr", $trans1_arr) );
+var_dump( strtr('test strtr', $trans2_arr) );
+var_dump( strtr($heredoc_str, $trans1_arr) );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : basic functionality ***
+string(10) "TesT sTrTr"
+string(10) "TesT sTrTr"
+string(10) "TesT sTrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() : basic functionality ***
+unicode(10) "TesT sTrTr"
+unicode(10) "TesT sTrTr"
+unicode(10) "TesT sTrTr"
+string(10) "TEST STrTr"
+unicode(10) "TEST STrTr"
+unicode(10) "TEST STrTr"
+unicode(10) "TEST STrTr"
+unicode(10) "TEST STrTr"
+unicode(10) "TEST STrTr"
+unicode(10) "TEST STrTr"
+unicode(10) "TEST STrTr"
+unicode(10) "TEST STrTr"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_error.phpt b/ext/standard/tests/strings/strtr_error.phpt
new file mode 100644 (file)
index 0000000..a2d00c3
--- /dev/null
@@ -0,0 +1,56 @@
+--TEST--
+Test strtr() function : error conditions 
+--FILE--
+<?php
+/* Prototype  : string strtr(string str, string from[, string to])
+ * Description: Translates characters in str using given translation tables 
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strtr() : error conditions ***\n";
+$str = "string";
+$from = "string";
+$to = "STRING";
+$extra_arg = "extra_argument";
+
+echo "\n-- Testing strtr() function with Zero arguments --";
+var_dump( strtr() );
+
+echo "\n-- Testing strtr() function with less than expected no. of arguments --";
+var_dump( strtr($str) );
+
+echo "\n-- Testing strtr() function with more than expected no. of arguments --";
+var_dump( strtr($str, $from, $to, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strtr() : error conditions ***
+
+-- Testing strtr() function with Zero arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+
+-- Testing strtr() function with less than expected no. of arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+
+-- Testing strtr() function with more than expected no. of arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+Done
+--UEXPECTF--
+*** Testing strtr() : error conditions ***
+
+-- Testing strtr() function with Zero arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+
+-- Testing strtr() function with less than expected no. of arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+
+-- Testing strtr() function with more than expected no. of arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strtr_variation1.phpt b/ext/standard/tests/strings/strtr_variation1.phpt
new file mode 100644 (file)
index 0000000..b5bbfb0
--- /dev/null
@@ -0,0 +1,114 @@
+--TEST--
+Test strtr() function : usage variations - regular & numeric strings for 'str' argument
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ *   combination of numeric & regular strings for 'str' argument and
+ *   corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : numeric & regular double quoted strings ***\n";
+/* definitions of required input variables */
+$count = 1;
+$heredoc_str = <<<EOD
+123
+abc
+1a2b3c
+EOD;
+//array of string inputs for $str
+$str_arr = array(
+  //double quoted strings
+  "123",
+  "abc",
+  "1a2b3c",
+
+  //single quoted strings
+  '123',
+  'abc',
+  '1a2b3c',
+
+  //heredoc string
+  $heredoc_str
+);
+$from = "123abc";
+$to = "abc123";
+$replace_pairs = array("1" => "a", "a" => 1, "2b3c" => "b2c3", "b2c3" => "3c2b");
+
+/* loop through to test strtr() with each element of $str_arr */
+for($index = 0; $index < count($str_arr); $index++) {
+  echo "-- Iteration $count --\n";
+
+  $str = $str_arr[$index];  //getting the $str_arr element in $str variable
+
+  //strtr() call in three args syntax form
+  var_dump( strtr($str, $from, $to) );
+
+  //strtr() call in two args syntax form
+  var_dump( strtr($str, $replace_pairs) );
+
+  $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : numeric & regular double quoted strings ***
+-- Iteration 1 --
+string(3) "abc"
+string(3) "a23"
+-- Iteration 2 --
+string(3) "123"
+string(3) "1bc"
+-- Iteration 3 --
+string(6) "a1b2c3"
+string(6) "a1b2c3"
+-- Iteration 4 --
+string(3) "abc"
+string(3) "a23"
+-- Iteration 5 --
+string(3) "123"
+string(3) "1bc"
+-- Iteration 6 --
+string(6) "a1b2c3"
+string(6) "a1b2c3"
+-- Iteration 7 --
+string(14) "abc
+123
+a1b2c3"
+string(14) "a23
+1bc
+a1b2c3"
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() : numeric & regular double quoted strings ***
+-- Iteration 1 --
+unicode(3) "abc"
+unicode(3) "a23"
+-- Iteration 2 --
+unicode(3) "123"
+unicode(3) "1bc"
+-- Iteration 3 --
+unicode(6) "a1b2c3"
+unicode(6) "a1b2c3"
+-- Iteration 4 --
+unicode(3) "abc"
+unicode(3) "a23"
+-- Iteration 5 --
+unicode(3) "123"
+unicode(3) "1bc"
+-- Iteration 6 --
+unicode(6) "a1b2c3"
+unicode(6) "a1b2c3"
+-- Iteration 7 --
+unicode(14) "abc
+123
+a1b2c3"
+unicode(14) "a23
+1bc
+a1b2c3"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation2.phpt b/ext/standard/tests/strings/strtr_variation2.phpt
new file mode 100644 (file)
index 0000000..8405e2e
--- /dev/null
@@ -0,0 +1,118 @@
+--TEST--
+Test strtr() function : usage variations - string containing special chars for 'str' argument
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ *   string containing various special characters for 'str' argument and
+ *   corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : string containing special chars for 'str' arg ***\n";
+
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+%
+#$*&
+text & @()
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+  //double quoted strings
+  "%",
+  "#$*",
+  "text & @()",
+
+  //single quoted strings
+  '%',
+  '#$*',
+  'text & @()',
+
+  //heredoc string
+  $heredoc_str
+);
+
+$from = "%#$*&@()";
+$to = "specials";
+$replace_pairs = array("$" => "%", "%" => "$", "#*&@()" => "()@&*#");
+
+/* loop through to test strtr() with each element of $str_arr */
+for($index = 0; $index < count($str_arr); $index++) {
+  echo "-- Iteration $count --\n";
+
+  $str = $str_arr[$index];  //getting the array element in 'str' variable
+
+  //strtr() call in three args syntax form
+  var_dump( strtr($str, $from, $to) );
+
+  //strtr() call in two args syntax form
+  var_dump( strtr($str, $replace_pairs) );
+
+  $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : string containing special chars for 'str' arg ***
+-- Iteration 1 --
+string(1) "s"
+string(1) "$"
+-- Iteration 2 --
+string(3) "pec"
+string(3) "#%*"
+-- Iteration 3 --
+string(10) "text i als"
+string(10) "text & @()"
+-- Iteration 4 --
+string(1) "s"
+string(1) "$"
+-- Iteration 5 --
+string(3) "pec"
+string(3) "#%*"
+-- Iteration 6 --
+string(10) "text i als"
+string(10) "text & @()"
+-- Iteration 7 --
+string(17) "s
+peci
+text i als"
+string(17) "$
+#%*&
+text & @()"
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() : string containing special chars for 'str' arg ***
+-- Iteration 1 --
+unicode(1) "s"
+unicode(1) "$"
+-- Iteration 2 --
+unicode(3) "pec"
+unicode(3) "#%*"
+-- Iteration 3 --
+unicode(10) "text i als"
+unicode(10) "text & @()"
+-- Iteration 4 --
+unicode(1) "s"
+unicode(1) "$"
+-- Iteration 5 --
+unicode(3) "pec"
+unicode(3) "#%*"
+-- Iteration 6 --
+unicode(10) "text i als"
+unicode(10) "text & @()"
+-- Iteration 7 --
+unicode(17) "s
+peci
+text i als"
+unicode(17) "$
+#%*&
+text & @()"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation3.phpt b/ext/standard/tests/strings/strtr_variation3.phpt
new file mode 100644 (file)
index 0000000..a878a8e
--- /dev/null
@@ -0,0 +1,141 @@
+--TEST--
+Test strtr() function : usage variations - string containing escape sequences for 'str' argument
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ *   string containing various escape sequences for 'str' argument and
+ *   corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : string containing escape sequences for 'str' arg ***\n";
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+\tes\t\\stt\r
+\\test\\\strtr
+\ntest\r\nstrtr
+\$variable
+\"quotes
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+  //double quoted strings
+  "\tes\t\\stt\r",
+  "\\test\\\strtr",
+  "\ntest\r\nstrtr",
+  "\$variable",
+  "\"quotes",
+
+  //single quoted strings
+  '\tes\t\\stt\r',
+  '\\test\\\strtr',
+  '\ntest\r\nstrtr',
+  '\$variable',
+  '\"quotes',
+
+  //heredoc string
+  $heredoc_str
+);
+
+$from = "\n\r\t\\";
+$to = "TEST";
+$replace_pairs = array("\n" => "t", "\r\n" => "T", "\n\r\t\\" => "TEST");
+
+/* loop through to test strtr() with each element of $str_arr */
+for($index = 0; $index < count($str_arr); $index++) {
+  echo "-- Iteration $count --\n";
+
+  $str = $str_arr[$index];  //getting the array element in 'str' variable
+
+  //strtr() call in three args syntax form
+  var_dump( strtr($str, $from, $to) );
+
+  //strtr() call in two args syntax form
+  var_dump( strtr($str, $replace_pairs) );
+
+  $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : string containing escape sequences for 'str' arg ***
+-- Iteration 1 --
+string(9) "SesSTsttE"
+string(9) "    es      \stt
+"
+-- Iteration 2 --
+string(12) "TtestTTstrtr"
+string(12) "\test\\strtr"
+-- Iteration 3 --
+string(12) "TtestETstrtr"
+string(11) "ttestTstrtr"
+-- Iteration 4 --
+string(9) "$variable"
+string(9) "$variable"
+-- Iteration 5 --
+string(7) ""quotes"
+string(7) ""quotes"
+-- Iteration 6 --
+string(12) "TtesTtTsttTr"
+string(12) "\tes\t\stt\r"
+-- Iteration 7 --
+string(12) "TtestTTstrtr"
+string(12) "\test\\strtr"
+-- Iteration 8 --
+string(15) "TntestTrTnstrtr"
+string(15) "\ntest\r\nstrtr"
+-- Iteration 9 --
+string(10) "T$variable"
+string(10) "\$variable"
+-- Iteration 10 --
+string(8) "T"quotes"
+string(8) "\"quotes"
+-- Iteration 11 --
+string(54) "SesSTsttETTtestTTstrtrTTtestETstrtrT$variableTT"quotes"
+string(52) "   es      \sttT\test\\strtrtttestTstrtrt$variablet\"quotes"
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() : string containing escape sequences for 'str' arg ***
+-- Iteration 1 --
+unicode(9) "SesSTsttE"
+unicode(9) "   es      \stt
+"
+-- Iteration 2 --
+unicode(12) "TtestTTstrtr"
+unicode(12) "\test\\strtr"
+-- Iteration 3 --
+unicode(12) "TtestETstrtr"
+unicode(11) "ttestTstrtr"
+-- Iteration 4 --
+unicode(9) "$variable"
+unicode(9) "$variable"
+-- Iteration 5 --
+unicode(7) ""quotes"
+unicode(7) ""quotes"
+-- Iteration 6 --
+unicode(12) "TtesTtTsttTr"
+unicode(12) "\tes\t\stt\r"
+-- Iteration 7 --
+unicode(12) "TtestTTstrtr"
+unicode(12) "\test\\strtr"
+-- Iteration 8 --
+unicode(15) "TntestTrTnstrtr"
+unicode(15) "\ntest\r\nstrtr"
+-- Iteration 9 --
+unicode(10) "T$variable"
+unicode(10) "\$variable"
+-- Iteration 10 --
+unicode(8) "T"quotes"
+unicode(8) "\"quotes"
+-- Iteration 11 --
+unicode(54) "SesSTsttETTtestTTstrtrTTtestETstrtrT$variableTT"quotes"
+unicode(52) "  es      \sttT\test\\strtrtttestTstrtrt$variablet\"quotes"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation4.phpt b/ext/standard/tests/strings/strtr_variation4.phpt
new file mode 100644 (file)
index 0000000..341b8d5
--- /dev/null
@@ -0,0 +1,103 @@
+--TEST--
+Test strtr() function : usage variations - empty string & null for 'str' argument
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ *   empty string & null for 'str' argument and
+ *   corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : empty string & null for 'str' arg ***\n";
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+  "",
+  '',
+  NULL,
+  null,
+  FALSE,
+  false,
+  $heredoc_str
+);
+
+$from = "";
+$to = "TEST";
+$replace_pairs = array("" => "t", '' => "TEST");
+
+
+/* loop through to test strtr() with each element of $str_arr */
+for($index = 0; $index < count($str_arr); $index++) {
+  echo "-- Iteration $count --\n";
+
+  $str = $str_arr[$index];  //getting the array element in 'str' variable
+
+  //strtr() call in three args syntax form
+  var_dump( strtr($str, $from, $to) );
+
+  //strtr() call in two args syntax form
+  var_dump( strtr($str, $replace_pairs) );
+
+  $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : empty string & null for 'str' arg ***
+-- Iteration 1 --
+string(0) ""
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+string(0) ""
+-- Iteration 3 --
+string(0) ""
+string(0) ""
+-- Iteration 4 --
+string(0) ""
+string(0) ""
+-- Iteration 5 --
+string(0) ""
+string(0) ""
+-- Iteration 6 --
+string(0) ""
+string(0) ""
+-- Iteration 7 --
+string(0) ""
+string(0) ""
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() : empty string & null for 'str' arg ***
+-- Iteration 1 --
+unicode(0) ""
+unicode(0) ""
+-- Iteration 2 --
+unicode(0) ""
+unicode(0) ""
+-- Iteration 3 --
+unicode(0) ""
+unicode(0) ""
+-- Iteration 4 --
+unicode(0) ""
+unicode(0) ""
+-- Iteration 5 --
+unicode(0) ""
+unicode(0) ""
+-- Iteration 6 --
+unicode(0) ""
+unicode(0) ""
+-- Iteration 7 --
+unicode(0) ""
+unicode(0) ""
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation5.phpt b/ext/standard/tests/strings/strtr_variation5.phpt
new file mode 100644 (file)
index 0000000..04b6976
--- /dev/null
@@ -0,0 +1,184 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for 'str' argument
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'str' 
+ *  and expected type for 'from' & 'to' arguments 
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'str' ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "sample object";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$strings =  array (
+
+  // integer values
+  0,
+  1,
+  -2,
+
+  // float values
+  10.5,
+  -20.5,
+  10.5e10,
+
+  // array values
+  array(),
+  array(0),
+  array(1, 2),
+
+  // boolean values
+  true,
+  false,
+  TRUE,
+  FALSE,
+
+  // null vlaues
+  NULL,
+  null,
+
+  // objects
+  new sample(),
+
+  // resource
+  $file_handle,
+
+  // undefined variable
+  @$undefined_var,
+
+  // unset variable
+  @$unset_var
+);
+
+//defining 'from' argument
+$from = "012atm";
+
+//defining 'to' argument
+$to = "atm012";
+
+// loop through with each element of the $strings array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($strings); $index++) {
+  echo "-- Iteration $count --\n";
+  $str = $strings[$index];
+  var_dump( strtr($str, $from, $to) );
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'str' ***
+-- Iteration 1 --
+string(1) "a"
+-- Iteration 2 --
+string(1) "t"
+-- Iteration 3 --
+string(2) "-m"
+-- Iteration 4 --
+string(4) "ta.5"
+-- Iteration 5 --
+string(5) "-ma.5"
+-- Iteration 6 --
+string(12) "ta5aaaaaaaaa"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Arr0y"
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Arr0y"
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Arr0y"
+-- Iteration 10 --
+string(1) "t"
+-- Iteration 11 --
+string(0) ""
+-- Iteration 12 --
+string(1) "t"
+-- Iteration 13 --
+string(0) ""
+-- Iteration 14 --
+string(0) ""
+-- Iteration 15 --
+string(0) ""
+-- Iteration 16 --
+string(13) "s02ple objec1"
+-- Iteration 17 --
+string(14) "Resource id #5"
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(0) ""
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'str' ***
+-- Iteration 1 --
+unicode(1) "a"
+-- Iteration 2 --
+unicode(1) "t"
+-- Iteration 3 --
+unicode(2) "-m"
+-- Iteration 4 --
+unicode(4) "ta.5"
+-- Iteration 5 --
+unicode(5) "-ma.5"
+-- Iteration 6 --
+unicode(12) "ta5aaaaaaaaa"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Arr0y"
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Arr0y"
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Arr0y"
+-- Iteration 10 --
+unicode(1) "t"
+-- Iteration 11 --
+unicode(0) ""
+-- Iteration 12 --
+unicode(1) "t"
+-- Iteration 13 --
+unicode(0) ""
+-- Iteration 14 --
+unicode(0) ""
+-- Iteration 15 --
+unicode(0) ""
+-- Iteration 16 --
+unicode(13) "s02ple objec1"
+-- Iteration 17 --
+unicode(14) "Resource id #5"
+-- Iteration 18 --
+unicode(0) ""
+-- Iteration 19 --
+unicode(0) ""
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation6.phpt b/ext/standard/tests/strings/strtr_variation6.phpt
new file mode 100644 (file)
index 0000000..067f10b
--- /dev/null
@@ -0,0 +1,184 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for 'from' argument(Bug #42861)
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'from' 
+ *  and expected type for 'str' & 'to' arguments 
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'from' ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "sample object";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//defining 'str' argument
+$str = "012atm";
+
+// array of values for 'from'
+$from_arr =  array (
+
+  // integer values
+  0,
+  1,
+  -2,
+
+  // float values
+  10.5,
+  -20.5,
+  10.5e10,
+
+  // array values
+  array(),
+  array(0),
+  array(1, 2),
+
+  // boolean values
+  true,
+  false,
+  TRUE,
+  FALSE,
+
+  // null vlaues
+  NULL,
+  null,
+
+  // objects
+  new sample(),
+
+  // resource
+  $file_handle,
+
+  // undefined variable
+  @$undefined_var,
+
+  // unset variable
+  @$unset_var
+);
+
+//defining 'to' argument
+$to = "atm012";
+
+// loop through with each element of the $from array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($from_arr); $index++) {
+  echo "-- Iteration $count --\n";
+  $from = $from_arr[$index];
+  var_dump( strtr($str, $from, $to) );
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'from' ***
+-- Iteration 1 --
+string(6) "a12atm"
+-- Iteration 2 --
+string(6) "0a2atm"
+-- Iteration 3 --
+string(6) "01tatm"
+-- Iteration 4 --
+string(6) "ta2atm"
+-- Iteration 5 --
+string(6) "m1tatm"
+-- Iteration 6 --
+string(6) "2a2atm"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "0120tm"
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "0120tm"
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "0120tm"
+-- Iteration 10 --
+string(6) "0a2atm"
+-- Iteration 11 --
+string(6) "012atm"
+-- Iteration 12 --
+string(6) "0a2atm"
+-- Iteration 13 --
+string(6) "012atm"
+-- Iteration 14 --
+string(6) "012atm"
+-- Iteration 15 --
+string(6) "012atm"
+-- Iteration 16 --
+string(6) "012ttm"
+-- Iteration 17 --
+string(6) "012atm"
+-- Iteration 18 --
+string(6) "012atm"
+-- Iteration 19 --
+string(6) "012atm"
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'from' ***
+-- Iteration 1 --
+unicode(6) "a12atm"
+-- Iteration 2 --
+unicode(6) "0a2atm"
+-- Iteration 3 --
+unicode(6) "01tatm"
+-- Iteration 4 --
+unicode(6) "ta2atm"
+-- Iteration 5 --
+unicode(6) "m1tatm"
+-- Iteration 6 --
+unicode(6) "2a2atm"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(6) "0120tm"
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(6) "0120tm"
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(6) "0120tm"
+-- Iteration 10 --
+unicode(6) "0a2atm"
+-- Iteration 11 --
+unicode(6) "012atm"
+-- Iteration 12 --
+unicode(6) "0a2atm"
+-- Iteration 13 --
+unicode(6) "012atm"
+-- Iteration 14 --
+unicode(6) "012atm"
+-- Iteration 15 --
+unicode(6) "012atm"
+-- Iteration 16 --
+unicode(6) "012ttm"
+-- Iteration 17 --
+unicode(6) "012atm"
+-- Iteration 18 --
+unicode(6) "012atm"
+-- Iteration 19 --
+unicode(6) "012atm"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation7.phpt b/ext/standard/tests/strings/strtr_variation7.phpt
new file mode 100644 (file)
index 0000000..136c1f6
--- /dev/null
@@ -0,0 +1,222 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for 'to' argument(Bug #42861)
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'to' 
+ *  and expected types for 'str' & 'from' arguments 
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'to' ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "sample object";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//defining 'str' argument
+$str = "012atm";
+
+//defining 'from' argument
+$from = "atm012";
+
+// array of values for 'to' argument
+$to_arr =  array (
+
+  // integer values
+  0,
+  1,
+  -2,
+
+  // float values
+  10.5,
+  -20.5,
+  10.5e10,
+
+  // array values
+  array(),
+  array(0),
+  array(1, 2),
+
+  // boolean values
+  true,
+  false,
+  TRUE,
+  FALSE,
+
+  // null vlaues
+  NULL,
+  null,
+
+  // objects
+  new sample(),
+
+  // resource
+  $file_handle,
+
+  // undefined variable
+  @$undefined_var,
+
+  // unset variable
+  @$unset_var
+);
+
+// loop through with each element of the $to array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($to_arr); $index++) {
+  echo "\n-- Iteration $count --\n";
+  $to = $to_arr[$index];
+  var_dump( strtr($str, $from, $to) );
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'to' ***
+
+-- Iteration 1 --
+string(6) "0120tm"
+
+-- Iteration 2 --
+string(6) "0121tm"
+
+-- Iteration 3 --
+string(6) "012-2m"
+
+-- Iteration 4 --
+string(6) "51210."
+
+-- Iteration 5 --
+string(6) ".52-20"
+
+-- Iteration 6 --
+string(6) "000105"
+
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "ay2Arr"
+
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "ay2Arr"
+
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "ay2Arr"
+
+-- Iteration 10 --
+string(6) "0121tm"
+
+-- Iteration 11 --
+string(6) "012atm"
+
+-- Iteration 12 --
+string(6) "0121tm"
+
+-- Iteration 13 --
+string(6) "012atm"
+
+-- Iteration 14 --
+string(6) "012atm"
+
+-- Iteration 15 --
+string(6) "012atm"
+
+-- Iteration 16 --
+string(6) "plesam"
+
+-- Iteration 17 --
+string(6) "ourRes"
+
+-- Iteration 18 --
+string(6) "012atm"
+
+-- Iteration 19 --
+string(6) "012atm"
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'to' ***
+
+-- Iteration 1 --
+unicode(6) "0120tm"
+
+-- Iteration 2 --
+unicode(6) "0121tm"
+
+-- Iteration 3 --
+unicode(6) "012-2m"
+
+-- Iteration 4 --
+unicode(6) "51210."
+
+-- Iteration 5 --
+unicode(6) ".52-20"
+
+-- Iteration 6 --
+unicode(6) "000105"
+
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(6) "ay2Arr"
+
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(6) "ay2Arr"
+
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+unicode(6) "ay2Arr"
+
+-- Iteration 10 --
+unicode(6) "0121tm"
+
+-- Iteration 11 --
+unicode(6) "012atm"
+
+-- Iteration 12 --
+unicode(6) "0121tm"
+
+-- Iteration 13 --
+unicode(6) "012atm"
+
+-- Iteration 14 --
+unicode(6) "012atm"
+
+-- Iteration 15 --
+unicode(6) "012atm"
+
+-- Iteration 16 --
+unicode(6) "plesam"
+
+-- Iteration 17 --
+unicode(6) "ourRes"
+
+-- Iteration 18 --
+unicode(6) "012atm"
+
+-- Iteration 19 --
+unicode(6) "012atm"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation8.phpt b/ext/standard/tests/strings/strtr_variation8.phpt
new file mode 100644 (file)
index 0000000..667ebb1
--- /dev/null
@@ -0,0 +1,271 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for 'replace_pairs' argument
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'replace_pairs' 
+ *  and expected type for 'str' arguments 
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "My String";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//defining 'str' argument
+$str = "012atm";
+
+// array of inputs for 'replace_pairs' argument
+$replace_pairs_arr =  array (
+
+  // integer values
+  0,
+  1,
+  -2,
+
+  // float values
+  10.5,
+  -20.5,
+  10.5e10,
+
+  // array values
+  array(),
+  array(0),
+  array(1, 2),
+
+  // boolean values
+  true,
+  false,
+  TRUE,
+  FALSE,
+
+  // null vlaues
+  NULL,
+  null,
+
+  // objects
+  new sample(),
+
+  // resource
+  $file_handle,
+
+  // undefined variable
+  @$undefined_var,
+
+  // unset variable
+  @$unset_var
+);
+
+// loop through with each element of the $replace_pairs array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($replace_pairs_arr); $index++) {
+  echo "\n-- Iteration $count --\n";
+  $replace_pairs = $replace_pairs_arr[$index];
+  var_dump( strtr($str, $replace_pairs) );
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***
+
+-- Iteration 1 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+string(6) "012atm"
+
+-- Iteration 8 --
+string(6) "012atm"
+
+-- Iteration 9 --
+string(6) "122atm"
+
+-- Iteration 10 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***
+
+-- Iteration 1 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+unicode(6) "012atm"
+
+-- Iteration 8 --
+unicode(6) "012atm"
+
+-- Iteration 9 --
+unicode(6) "122atm"
+
+-- Iteration 10 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation9.phpt b/ext/standard/tests/strings/strtr_variation9.phpt
new file mode 100644 (file)
index 0000000..19d48cf
--- /dev/null
@@ -0,0 +1,402 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for all arguments
+--FILE--
+<?php
+/* Prototype  : string strtr(string $str, string $from[, string $to]);
+                string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'str', 'from', 'to' & 'replace_pairs' arguments */
+
+echo "*** Testing strtr() function: with unexpected inputs for all arguments ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "My String";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values =  array (
+
+  // integer values
+  0,
+  1,
+  -2,
+
+  // float values
+  10.5,
+  -20.5,
+  10.5e10,
+
+  // array values
+  array(),
+  array(0),
+  array(1),
+  array(1, 2),
+  array('color' => 'red', 'item' => 'pen'),
+
+  // boolean values
+  true,
+  false,
+  TRUE,
+  FALSE,
+
+  // null vlaues
+  NULL,
+  null,
+
+  // objects
+  new sample(),
+
+  // resource
+  $file_handle,
+
+  // undefined variable
+  @$undefined_var,
+
+  // unset variable
+  @$unset_var
+);
+
+// loop through with each element of the $values array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($values); $index++) {
+  echo "\n-- Iteration $count --\n";
+  var_dump( strtr($values[$index], $values[$index], $values[$index]) ); //fn call with three args
+  var_dump( strtr($values[$index], $values[$index]) );  //fn call with two args
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for all arguments ***
+
+-- Iteration 1 --
+string(1) "0"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+string(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+string(2) "-2"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+string(4) "10.5"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+string(5) "-20.5"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+string(12) "105000000000"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+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
+
+Notice: Array to string conversion in %s on line %d
+
+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 --
+string(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+string(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+string(9) "My String"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+string(14) "Resource id #5"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+*** Done ***
+--UEXPECTF--
+*** Testing strtr() function: with unexpected inputs for all arguments ***
+
+-- Iteration 1 --
+unicode(1) "0"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+unicode(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+unicode(2) "-2"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+unicode(4) "10.5"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+unicode(5) "-20.5"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+unicode(12) "105000000000"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+unicode(5) "Array"
+
+-- Iteration 12 --
+unicode(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+unicode(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+unicode(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+unicode(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+unicode(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+unicode(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+unicode(9) "My String"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+unicode(14) "Resource id #5"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+unicode(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+unicode(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+*** Done ***