// array with different values
$values = array (
- // integer values
- 0,
- 1,
- 12345,
- -2345,
-
- // float values
- 10.5,
- -10.5,
- 10.5e10,
- 10.6E-10,
- .5,
-
- // array values
- array(),
- array(0),
- array(1),
- array(1, 2),
- array('color' => 'red', 'item' => 'pen'),
-
- // boolean values
- true,
- false,
- TRUE,
- FALSE,
-
- // empty string
- "",
- '',
-
- // undefined variable
- $undefined_var,
-
- // unset variable
- $unset_var,
-
- // objects
- new sample(),
-
- // resource
- $file_handle,
-
- NULL,
- null
+ // integer values
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+/*15*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+/*19*/ "",
+ '',
+
+ // undefined variable
+/*21*/ $undefined_var,
+
+ // unset variable
+/*22*/ $unset_var,
+
+ // objects
+/*23*/ new sample(),
+
+ // resource
+/*24*/ $file_handle,
+
+/*25*/ NULL,
+ null
);
// closing the file
fclose($file_handle);
-echo "Done\n";
?>
+===DONE===
--EXPECTF--
*** Testing addslashes() : with non-string type argument ***
-- Iteration 6 --
string(5) "-10.5"
-- Iteration 7 --
-string(12) "105000000000"
+string(12) "101234567000"
-- Iteration 8 --
-string(7) "1.06E-9"
+string(13) "1.07654321E-9"
-- Iteration 9 --
string(3) "0.5"
-- Iteration 10 --
string(0) ""
-- Iteration 26 --
string(0) ""
-Done
+===DONE===
--- /dev/null
+--TEST--
+Test bin2hex() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string bin2hex ( string $str )
+ * Description: Convert binary data into hexadecimal representation
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing bin2hex() : basic functionality ***\n";
+
+// array with different values for $string
+$strings = array (
+
+ //double quoted strings
+/*1*/ "Here is a simple string",
+ "\t This String contains \t\t some control characters\r\n",
+ "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
+
+ //single quoted strings
+/*4*/ 'Here is a simple string',
+ '\t This String contains \t\t some control characters\r\n',
+ '\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f',
+);
+
+// loop through with each element of the $strings array to test bin2hex() function
+$count = 1;
+foreach($strings as $string) {
+ echo "-- Iteration $count --\n";
+ var_dump(bin2hex($string));
+ $count ++;
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing bin2hex() : basic functionality ***
+-- Iteration 1 --
+string(46) "4865726520697320612073696d706c6520737472696e67"
+-- Iteration 2 --
+string(102) "09205468697320537472696e6720636f6e7461696e7320090920736f6d6520636f6e74726f6c20636861726163746572730d0a"
+-- Iteration 3 --
+string(36) "9091009394909195969798999a9b9c9d9e9f"
+-- Iteration 4 --
+string(46) "4865726520697320612073696d706c6520737472696e67"
+-- Iteration 5 --
+string(112) "5c74205468697320537472696e6720636f6e7461696e73205c745c7420736f6d6520636f6e74726f6c20636861726163746572735c725c6e"
+-- Iteration 6 --
+string(144) "5c7839305c7839315c7830305c7839335c7839345c7839305c7839315c7839355c7839365c7839375c7839385c7839395c7839615c7839625c7839635c7839645c7839655c783966"
+===DONE===
--- /dev/null
+--TEST--
+Test bin2hex() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string bin2hex ( string $str )
+ * Description: Convert binary data into hexadecimal representation
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing bin2hex() : error conditions ***\n";
+
+echo "\n-- Testing bin2hex() function with no arguments --\n";
+var_dump( bin2hex() );
+
+echo "\n-- Testing bin2hex() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( bin2hex("Hello World", $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing bin2hex() : error conditions ***
+
+-- Testing bin2hex() function with no arguments --
+
+Warning: Wrong parameter count for bin2hex() in %s on line %d
+NULL
+
+-- Testing bin2hex() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for bin2hex() in %s on line %d
+NULL
+
+===DONE===
--- /dev/null
+--TEST--
+Test bin2hex() function : usage variations - test values for $str argument
+--FILE--
+<?php
+
+/* Prototype : string bin2hex ( string $str )
+ * Description: Convert binary data into hexadecimal representation
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing bin2hex() function: with unexpected inputs for 'str' argument ***\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 for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 123456,
+
+ // float values
+/*4*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*7*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*10*/true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*14*/NULL,
+ null,
+
+ // objects
+/*16*/new sample(),
+
+ // resource
+/*17*/$file_handle,
+
+ // undefined variable
+/*18*/@$undefined_var,
+
+ // unset variable
+/*19*/@$unset_var
+);
+
+// loop through with each element of the $inputs array to test bin2hex() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump(bin2hex($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing bin2hex() function: with unexpected inputs for 'str' argument ***
+-- Iteration 1 --
+string(2) "30"
+-- Iteration 2 --
+string(2) "31"
+-- Iteration 3 --
+string(12) "313233343536"
+-- Iteration 4 --
+string(8) "31302e35"
+-- Iteration 5 --
+string(10) "2d32302e35"
+-- Iteration 6 --
+string(24) "313031323334353637303030"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "4172726179"
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "4172726179"
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "4172726179"
+-- Iteration 10 --
+string(2) "31"
+-- Iteration 11 --
+string(0) ""
+-- Iteration 12 --
+string(2) "31"
+-- Iteration 13 --
+string(0) ""
+-- Iteration 14 --
+string(0) ""
+-- Iteration 15 --
+string(0) ""
+-- Iteration 16 --
+string(26) "73616d706c65206f626a656374"
+-- Iteration 17 --
+string(%d) "%s"
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(0) ""
+===DONE===
$func = create_function('$a', 'return $a;');
var_export($func);
?>
---EXPECT--
-'' . "\0" . 'lambda_1'
+--EXPECTF--
+'' . "\0" . 'lambda_%d'
--- /dev/null
+--TEST--
+Bug #45166 (substr() )
+--FILE--
+<?php
+ echo substr('cd', -3) . "\n";
+?>
+===DONE===
+--EXPECT--
+cd
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test chr() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string chr ( int $ascii )
+ * Description: Return a specific character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing chr() : basic functionality ***\n";
+
+echo chr(72). chr(101) . chr(108) . chr(108). chr(111); // Hello
+echo chr(10); // "\n"
+echo "World";
+echo "\n";
+?>
+===DONE===
+--EXPECTF--
+*** Testing chr() : basic functionality ***
+Hello
+World
+===DONE===
--- /dev/null
+--TEST--
+Test chr() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string chr ( int $ascii )
+ * Description: Return a specific character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing chr() : error conditions ***\n";
+
+echo "\n-- Testing chr() function with no arguments --\n";
+var_dump( chr() );
+
+echo "\n-- Testing chr() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( chr(72, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing chr() : error conditions ***
+
+-- Testing chr() function with no arguments --
+
+Warning: Wrong parameter count for chr() in %s on line %d
+NULL
+
+-- Testing chr() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for chr() in %s on line %d
+NULL
+===DONE===
--- /dev/null
+--TEST--
+Test chr() function : usage variations - test values for $ascii argument
+--FILE--
+<?php
+
+/* Prototype : string chr ( int $ascii )
+ * Description: Return a specific character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing chr() function: with unexpected inputs for 'ascii' argument ***\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 for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+
+ // float values
+/*5*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*8*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*15*/ NULL,
+ null,
+
+ // objects
+/*17*/ new sample(),
+
+ // resource
+/*18*/ $file_handle,
+
+ // undefined variable
+/*19*/ @$undefined_var,
+
+ // unset variable
+/*20*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test chr() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( bin2hex(chr($input)) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing chr() function: with unexpected inputs for 'ascii' argument ***
+-- Iteration 1 --
+string(2) "00"
+-- Iteration 2 --
+string(2) "01"
+-- Iteration 3 --
+string(2) "ff"
+-- Iteration 4 --
+string(2) "00"
+-- Iteration 5 --
+string(2) "0a"
+-- Iteration 6 --
+string(2) "ec"
+-- Iteration 7 --
+string(2) "58"
+-- Iteration 8 --
+string(2) "00"
+-- Iteration 9 --
+string(2) "01"
+-- Iteration 10 --
+string(2) "01"
+-- Iteration 11 --
+string(2) "01"
+-- Iteration 12 --
+string(2) "00"
+-- Iteration 13 --
+string(2) "01"
+-- Iteration 14 --
+string(2) "00"
+-- Iteration 15 --
+string(2) "00"
+-- Iteration 16 --
+string(2) "00"
+-- Iteration 17 --
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+string(2) "01"
+-- Iteration 18 --
+string(%d) "%s"
+-- Iteration 19 --
+string(2) "00"
+-- Iteration 20 --
+string(2) "00"
+===DONE===
--- /dev/null
+--TEST--
+Test convert_cyr_string() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
+ * Description: Convert from one Cyrillic character set to another
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing convert_cyr_string() : basic functionality ***\n";
+
+$str = "Convert from one Cyrillic character set to another.";
+
+echo "\n-- First try some simple English text --\n";
+var_dump(bin2hex(convert_cyr_string($str, 'w', 'k')));
+var_dump(bin2hex(convert_cyr_string($str, 'w', 'i')));
+
+
+echo "\n-- Now try some of characters in 128-255 range --\n";
+
+for ($i = 128; $i < 256; $i++) {
+ $str = chr($i);
+ echo "$i: " . bin2hex(convert_cyr_string($str, 'w', 'k')) . "\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_cyr_string() : basic functionality ***
+
+-- First try some simple English text --
+string(102) "436f6e766572742066726f6d206f6e6520437972696c6c6963206368617261637465722073657420746f20616e6f746865722e"
+string(102) "436f6e766572742066726f6d206f6e6520437972696c6c6963206368617261637465722073657420746f20616e6f746865722e"
+
+-- Now try some of characters in 128-255 range --
+128: 2e
+129: 2e
+130: 2e
+131: 2e
+132: 2e
+133: 2e
+134: 2e
+135: 2e
+136: 2e
+137: 2e
+138: 2e
+139: 2e
+140: 2e
+141: 2e
+142: 2e
+143: 2e
+144: 2e
+145: 2e
+146: 2e
+147: 2e
+148: 2e
+149: 2e
+150: 2e
+151: 2e
+152: 2e
+153: 2e
+154: 2e
+155: 2e
+156: 2e
+157: 2e
+158: 2e
+159: 2e
+160: 9a
+161: ae
+162: be
+163: 2e
+164: 9f
+165: bd
+166: 2e
+167: 2e
+168: b3
+169: bf
+170: b4
+171: 9d
+172: 2e
+173: 2e
+174: 9c
+175: b7
+176: 2e
+177: 2e
+178: b6
+179: a6
+180: ad
+181: 2e
+182: 2e
+183: 9e
+184: a3
+185: 98
+186: a4
+187: 9b
+188: 2e
+189: 2e
+190: 2e
+191: a7
+192: e1
+193: e2
+194: f7
+195: e7
+196: e4
+197: e5
+198: f6
+199: fa
+200: e9
+201: ea
+202: eb
+203: ec
+204: ed
+205: ee
+206: ef
+207: f0
+208: f2
+209: f3
+210: f4
+211: f5
+212: e6
+213: e8
+214: e3
+215: fe
+216: fb
+217: fd
+218: ff
+219: f9
+220: f8
+221: fc
+222: e0
+223: f1
+224: c1
+225: c2
+226: d7
+227: c7
+228: c4
+229: c5
+230: d6
+231: da
+232: c9
+233: ca
+234: cb
+235: cc
+236: cd
+237: ce
+238: cf
+239: d0
+240: d2
+241: d3
+242: d4
+243: d5
+244: c6
+245: c8
+246: c3
+247: de
+248: db
+249: dd
+250: df
+251: d9
+252: d8
+253: dc
+254: c0
+255: d1
+===DONE===
--- /dev/null
+--TEST--
+Test convert_cyr_string() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
+ * Description: Convert from one Cyrillic character set to another
+ * Source code: ext/standard/string.c
+*/
+
+$str = "hello";
+$from = "k";
+$to = "d";
+$extra_arg = 10;
+
+echo "*** Testing convert_cyr_string() : error conditions ***\n";
+
+echo "\n-- Testing convert_cyr_string() function with no arguments --\n";
+var_dump( convert_cyr_string() );
+
+echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n";
+var_dump( convert_cyr_string($str, $from) );
+
+echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n";
+var_dump( convert_cyr_string($str, $from, $to, $extra_arg) );
+
+echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n";
+var_dump(bin2hex( convert_cyr_string($str, "?", $to) ));
+
+echo "\n-- Testing convert_cyr_string() function with invalid 'to' character set --\n";
+var_dump(bin2hex( convert_cyr_string($str, $from, "?")) );
+
+echo "\n-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --\n";
+var_dump(bin2hex( convert_cyr_string($str, ">", "?")) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_cyr_string() : error conditions ***
+
+-- Testing convert_cyr_string() function with no arguments --
+
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+-- Testing convert_cyr_string() function with no 'to' character set --
+
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+-- Testing convert_cyr_string() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+-- Testing convert_cyr_string() function with invalid 'from' character set --
+
+Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d
+string(10) "68656c6c6f"
+
+-- Testing convert_cyr_string() function with invalid 'to' character set --
+
+Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
+string(10) "68656c6c6f"
+
+-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --
+
+Warning: convert_cyr_string(): Unknown source charset: > in %s on line %d
+
+Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
+string(10) "68656c6c6f"
+
+===DONE===
--- /dev/null
+--TEST--
+Test convert_cyr_string() function : usage variations - test values for $str argument
+--FILE--
+<?php
+
+/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
+ * Description: Convert from one Cyrillic character set to another
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing convert_cyr_string() function: with unexpected inputs for 'str' argument ***\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 for $str
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test convert_cyr_string() function
+$count = 1;
+$from = "w";
+$to = "k";
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( convert_cyr_string($input, $from, $to) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_cyr_string() function: with unexpected inputs for 'str' argument ***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(3) "255"
+-- Iteration 4 --
+string(3) "256"
+-- Iteration 5 --
+string(10) "2147483647"
+-- Iteration 6 --
+string(11) "-2147483648"
+-- Iteration 7 --
+string(4) "10.5"
+-- Iteration 8 --
+string(5) "-20.5"
+-- Iteration 9 --
+string(12) "101234567000"
+-- Iteration 10 --
+
+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"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 13 --
+string(1) "1"
+-- Iteration 14 --
+string(0) ""
+-- Iteration 15 --
+string(1) "1"
+-- Iteration 16 --
+string(0) ""
+-- Iteration 17 --
+string(0) ""
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(13) "sample object"
+-- Iteration 20 --
+string(%d) "Resource id #%d"
+-- Iteration 21 --
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+===DONE===
--- /dev/null
+--TEST--
+Test convert_uudecode() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string convert_uudecode ( string $data )
+ * Description: Decode a uuencoded string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uudecode() : basic functionality ***\n";
+
+// array with different values for $string
+$strings = array (
+
+ //double quoted strings
+ "123",
+ "abc",
+ "1a2b3c",
+ "Here is a simple string to test convert_uuencode/decode",
+ "\t This String contains \t\t some control characters\r\n",
+ "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
+
+ //single quoted strings
+ '123',
+ 'abc',
+ '1a2b3c',
+ '\t This String contains \t\t some control characters\r\n',
+
+);
+
+// loop through with each element of the $strings array to test convert_uudecode() function
+$count = 1;
+foreach($strings as $string) {
+
+ $encode = convert_uuencode($string);
+ $decode = convert_uudecode($encode);
+
+ if ($decode != $string) {
+ var_dump($encode, $decode, $string);
+ exit("TEST FAILED on iteration $count\n");
+ }
+
+ $count ++;
+}
+
+echo "TEST PASSED\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uudecode() : basic functionality ***
+TEST PASSED
+===DONE===
--- /dev/null
+--TEST--
+Test convert_uudecode() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string convert_uudecode ( string $data )
+ * Description: Decode a uuencoded string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uudecode() : error conditions ***\n";
+
+echo "\n-- Testing convert_uudecode() function with no arguments --\n";
+var_dump( convert_uudecode() );
+
+echo "\n-- Testing convert_uudecode() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( convert_uudecode(72, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uudecode() : error conditions ***
+
+-- Testing convert_uudecode() function with no arguments --
+
+Warning: convert_uudecode() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing convert_uudecode() function with more than expected no. of arguments --
+
+Warning: convert_uudecode() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+===DONE===
--- /dev/null
+--TEST--
+Test convert_uudecode() function : usage variations - test values for $data argument
+--FILE--
+<?php
+
+/* Prototype : string convert_uudecode ( string $data )
+ * Description: Decode a uuencoded string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***\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 for $data
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $data array to test convert_uudecode() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( convert_uudecode($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***
+-- Iteration 1 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: convert_uudecode() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE===
--- /dev/null
+--TEST--
+Test convert_uuencode() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string convert_uuencode ( string $data )
+ * Description: Uuencode a string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uuencode() : basic functionality ***\n";
+
+// array with different values for $string
+$strings = array (
+
+ //double quoted strings
+ b"123",
+ b"abc",
+ b"1a2b3c",
+ b"Here is a simple string to test convert_uuencode/decode",
+ b"\t This String contains \t\t some control characters\r\n",
+ b"\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
+
+ //single quoted strings
+ b'123',
+ b'abc',
+ b'1a2b3c',
+ b'\t This String contains \t\t some control characters\r\n',
+
+);
+
+// loop through with each element of the $strings array to test convert_uuencode() function
+$count = 1;
+foreach($strings as $string) {
+ echo "-- Iteration $count --\n";
+ var_dump( convert_uuencode($string) );
+ $count ++;
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uuencode() : basic functionality ***
+-- Iteration 1 --
+string(8) "#,3(S
+`
+"
+-- Iteration 2 --
+string(8) "#86)C
+`
+"
+-- Iteration 3 --
+string(12) "&,6$R8C-C
+`
+"
+-- Iteration 4 --
+string(82) "M2&5R92!I<R!A('-I;7!L92!S=')I;F<@=&\@=&5S="!C;VYV97)T7W5U96YC
+*;V1E+V1E8V]D90``
+`
+"
+-- Iteration 5 --
+string(74) "M"2!4:&ES(%-T<FEN9R!C;VYT86EN<R`)"2!S;VUE(&-O;G1R;VP@8VAA<F%C
+&=&5R<PT*
+`
+"
+-- Iteration 6 --
+string(28) "2D)$`DY20D966EYB9FIN<G9Z?
+`
+"
+-- Iteration 7 --
+string(8) "#,3(S
+`
+"
+-- Iteration 8 --
+string(8) "#86)C
+`
+"
+-- Iteration 9 --
+string(12) "&,6$R8C-C
+`
+"
+-- Iteration 10 --
+string(82) "M7'0@5&AI<R!3=')I;F<@8V]N=&%I;G,@7'1<="!S;VUE(&-O;G1R;VP@8VAA
++<F%C=&5R<UQR7&X`
+`
+"
+===DONE===
--- /dev/null
+--TEST--
+Test convert_uuencode() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string convert_uuencode ( string $data )
+ * Description: Uuencode a string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uuencode() : error conditions ***\n";
+
+echo "\n-- Testing chconvert_uuencoder() function with no arguments --\n";
+var_dump( convert_uuencode() );
+
+echo "\n-- Testing convert_uuencode() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( convert_uuencode(72, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uuencode() : error conditions ***
+
+-- Testing chconvert_uuencoder() function with no arguments --
+
+Warning: convert_uuencode() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing convert_uuencode() function with more than expected no. of arguments --
+
+Warning: convert_uuencode() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+===DONE===
--- /dev/null
+--TEST--
+Test convert_uuencode() function : usage variations - test values for $data argument
+--FILE--
+<?php
+
+/* Prototype : string convert_uuencode ( string $data )
+ * Description: Uuencode a string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument ***\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 for $data
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $data array to test convert_uuencode() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( bin2hex(convert_uuencode($input)) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument ***
+-- Iteration 1 --
+string(16) "212c6060600a600a"
+-- Iteration 2 --
+string(16) "212c3060600a600a"
+-- Iteration 3 --
+string(16) "232c4334550a600a"
+-- Iteration 4 --
+string(16) "232c4334560a600a"
+-- Iteration 5 --
+string(40) "2a2c4324542d5330582c5338542d5060600a600a"
+-- Iteration 6 --
+string(40) "2b2b3328512d233c542e232c562d2340600a600a"
+-- Iteration 7 --
+string(24) "242c33604e2d3060600a600a"
+-- Iteration 8 --
+string(24) "252b3328502b4334600a600a"
+-- Iteration 9 --
+string(40) "2c2c3360512c432c542d3338572c2360500a600a"
+-- Iteration 10 --
+
+Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+-- Iteration 11 --
+
+Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+-- Iteration 12 --
+
+Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+-- Iteration 13 --
+string(16) "212c3060600a600a"
+-- Iteration 14 --
+string(0) ""
+-- Iteration 15 --
+string(16) "212c3060600a600a"
+-- Iteration 16 --
+string(0) ""
+-- Iteration 17 --
+string(0) ""
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(48) "2d3c56254d3c26514528265d423a4635433d6060600a600a"
+-- Iteration 20 --
+
+Warning: convert_uuencode() expects parameter 1 to be string, resource given in %s on line %d
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+===DONE===
--- /dev/null
+--TEST--
+Test count_chars() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : mixed count_chars ( string $string [, int $mode ] )
+ * Description: Return information about characters used in a string
+ * Source code: ext/standard/string.c
+*/
+
+
+echo "*** Testing count_chars() : basic functionality ***\n";
+
+$string = "Return information about characters used in a string";
+
+var_dump(count_chars($string));
+var_dump(count_chars($string, 0));
+var_dump(count_chars($string, 1));
+var_dump(count_chars($string, 2));
+var_dump(count_chars($string, 3));
+var_dump(bin2hex(count_chars($string, 4)));
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing count_chars() : basic functionality ***
+array(256) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(0)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+ [9]=>
+ int(0)
+ [10]=>
+ int(0)
+ [11]=>
+ int(0)
+ [12]=>
+ int(0)
+ [13]=>
+ int(0)
+ [14]=>
+ int(0)
+ [15]=>
+ int(0)
+ [16]=>
+ int(0)
+ [17]=>
+ int(0)
+ [18]=>
+ int(0)
+ [19]=>
+ int(0)
+ [20]=>
+ int(0)
+ [21]=>
+ int(0)
+ [22]=>
+ int(0)
+ [23]=>
+ int(0)
+ [24]=>
+ int(0)
+ [25]=>
+ int(0)
+ [26]=>
+ int(0)
+ [27]=>
+ int(0)
+ [28]=>
+ int(0)
+ [29]=>
+ int(0)
+ [30]=>
+ int(0)
+ [31]=>
+ int(0)
+ [32]=>
+ int(7)
+ [33]=>
+ int(0)
+ [34]=>
+ int(0)
+ [35]=>
+ int(0)
+ [36]=>
+ int(0)
+ [37]=>
+ int(0)
+ [38]=>
+ int(0)
+ [39]=>
+ int(0)
+ [40]=>
+ int(0)
+ [41]=>
+ int(0)
+ [42]=>
+ int(0)
+ [43]=>
+ int(0)
+ [44]=>
+ int(0)
+ [45]=>
+ int(0)
+ [46]=>
+ int(0)
+ [47]=>
+ int(0)
+ [48]=>
+ int(0)
+ [49]=>
+ int(0)
+ [50]=>
+ int(0)
+ [51]=>
+ int(0)
+ [52]=>
+ int(0)
+ [53]=>
+ int(0)
+ [54]=>
+ int(0)
+ [55]=>
+ int(0)
+ [56]=>
+ int(0)
+ [57]=>
+ int(0)
+ [58]=>
+ int(0)
+ [59]=>
+ int(0)
+ [60]=>
+ int(0)
+ [61]=>
+ int(0)
+ [62]=>
+ int(0)
+ [63]=>
+ int(0)
+ [64]=>
+ int(0)
+ [65]=>
+ int(0)
+ [66]=>
+ int(0)
+ [67]=>
+ int(0)
+ [68]=>
+ int(0)
+ [69]=>
+ int(0)
+ [70]=>
+ int(0)
+ [71]=>
+ int(0)
+ [72]=>
+ int(0)
+ [73]=>
+ int(0)
+ [74]=>
+ int(0)
+ [75]=>
+ int(0)
+ [76]=>
+ int(0)
+ [77]=>
+ int(0)
+ [78]=>
+ int(0)
+ [79]=>
+ int(0)
+ [80]=>
+ int(0)
+ [81]=>
+ int(0)
+ [82]=>
+ int(1)
+ [83]=>
+ int(0)
+ [84]=>
+ int(0)
+ [85]=>
+ int(0)
+ [86]=>
+ int(0)
+ [87]=>
+ int(0)
+ [88]=>
+ int(0)
+ [89]=>
+ int(0)
+ [90]=>
+ int(0)
+ [91]=>
+ int(0)
+ [92]=>
+ int(0)
+ [93]=>
+ int(0)
+ [94]=>
+ int(0)
+ [95]=>
+ int(0)
+ [96]=>
+ int(0)
+ [97]=>
+ int(5)
+ [98]=>
+ int(1)
+ [99]=>
+ int(2)
+ [100]=>
+ int(1)
+ [101]=>
+ int(3)
+ [102]=>
+ int(1)
+ [103]=>
+ int(1)
+ [104]=>
+ int(1)
+ [105]=>
+ int(4)
+ [106]=>
+ int(0)
+ [107]=>
+ int(0)
+ [108]=>
+ int(0)
+ [109]=>
+ int(1)
+ [110]=>
+ int(5)
+ [111]=>
+ int(3)
+ [112]=>
+ int(0)
+ [113]=>
+ int(0)
+ [114]=>
+ int(5)
+ [115]=>
+ int(3)
+ [116]=>
+ int(5)
+ [117]=>
+ int(3)
+ [118]=>
+ int(0)
+ [119]=>
+ int(0)
+ [120]=>
+ int(0)
+ [121]=>
+ int(0)
+ [122]=>
+ int(0)
+ [123]=>
+ int(0)
+ [124]=>
+ int(0)
+ [125]=>
+ int(0)
+ [126]=>
+ int(0)
+ [127]=>
+ int(0)
+ [128]=>
+ int(0)
+ [129]=>
+ int(0)
+ [130]=>
+ int(0)
+ [131]=>
+ int(0)
+ [132]=>
+ int(0)
+ [133]=>
+ int(0)
+ [134]=>
+ int(0)
+ [135]=>
+ int(0)
+ [136]=>
+ int(0)
+ [137]=>
+ int(0)
+ [138]=>
+ int(0)
+ [139]=>
+ int(0)
+ [140]=>
+ int(0)
+ [141]=>
+ int(0)
+ [142]=>
+ int(0)
+ [143]=>
+ int(0)
+ [144]=>
+ int(0)
+ [145]=>
+ int(0)
+ [146]=>
+ int(0)
+ [147]=>
+ int(0)
+ [148]=>
+ int(0)
+ [149]=>
+ int(0)
+ [150]=>
+ int(0)
+ [151]=>
+ int(0)
+ [152]=>
+ int(0)
+ [153]=>
+ int(0)
+ [154]=>
+ int(0)
+ [155]=>
+ int(0)
+ [156]=>
+ int(0)
+ [157]=>
+ int(0)
+ [158]=>
+ int(0)
+ [159]=>
+ int(0)
+ [160]=>
+ int(0)
+ [161]=>
+ int(0)
+ [162]=>
+ int(0)
+ [163]=>
+ int(0)
+ [164]=>
+ int(0)
+ [165]=>
+ int(0)
+ [166]=>
+ int(0)
+ [167]=>
+ int(0)
+ [168]=>
+ int(0)
+ [169]=>
+ int(0)
+ [170]=>
+ int(0)
+ [171]=>
+ int(0)
+ [172]=>
+ int(0)
+ [173]=>
+ int(0)
+ [174]=>
+ int(0)
+ [175]=>
+ int(0)
+ [176]=>
+ int(0)
+ [177]=>
+ int(0)
+ [178]=>
+ int(0)
+ [179]=>
+ int(0)
+ [180]=>
+ int(0)
+ [181]=>
+ int(0)
+ [182]=>
+ int(0)
+ [183]=>
+ int(0)
+ [184]=>
+ int(0)
+ [185]=>
+ int(0)
+ [186]=>
+ int(0)
+ [187]=>
+ int(0)
+ [188]=>
+ int(0)
+ [189]=>
+ int(0)
+ [190]=>
+ int(0)
+ [191]=>
+ int(0)
+ [192]=>
+ int(0)
+ [193]=>
+ int(0)
+ [194]=>
+ int(0)
+ [195]=>
+ int(0)
+ [196]=>
+ int(0)
+ [197]=>
+ int(0)
+ [198]=>
+ int(0)
+ [199]=>
+ int(0)
+ [200]=>
+ int(0)
+ [201]=>
+ int(0)
+ [202]=>
+ int(0)
+ [203]=>
+ int(0)
+ [204]=>
+ int(0)
+ [205]=>
+ int(0)
+ [206]=>
+ int(0)
+ [207]=>
+ int(0)
+ [208]=>
+ int(0)
+ [209]=>
+ int(0)
+ [210]=>
+ int(0)
+ [211]=>
+ int(0)
+ [212]=>
+ int(0)
+ [213]=>
+ int(0)
+ [214]=>
+ int(0)
+ [215]=>
+ int(0)
+ [216]=>
+ int(0)
+ [217]=>
+ int(0)
+ [218]=>
+ int(0)
+ [219]=>
+ int(0)
+ [220]=>
+ int(0)
+ [221]=>
+ int(0)
+ [222]=>
+ int(0)
+ [223]=>
+ int(0)
+ [224]=>
+ int(0)
+ [225]=>
+ int(0)
+ [226]=>
+ int(0)
+ [227]=>
+ int(0)
+ [228]=>
+ int(0)
+ [229]=>
+ int(0)
+ [230]=>
+ int(0)
+ [231]=>
+ int(0)
+ [232]=>
+ int(0)
+ [233]=>
+ int(0)
+ [234]=>
+ int(0)
+ [235]=>
+ int(0)
+ [236]=>
+ int(0)
+ [237]=>
+ int(0)
+ [238]=>
+ int(0)
+ [239]=>
+ int(0)
+ [240]=>
+ int(0)
+ [241]=>
+ int(0)
+ [242]=>
+ int(0)
+ [243]=>
+ int(0)
+ [244]=>
+ int(0)
+ [245]=>
+ int(0)
+ [246]=>
+ int(0)
+ [247]=>
+ int(0)
+ [248]=>
+ int(0)
+ [249]=>
+ int(0)
+ [250]=>
+ int(0)
+ [251]=>
+ int(0)
+ [252]=>
+ int(0)
+ [253]=>
+ int(0)
+ [254]=>
+ int(0)
+ [255]=>
+ int(0)
+}
+array(256) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(0)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+ [9]=>
+ int(0)
+ [10]=>
+ int(0)
+ [11]=>
+ int(0)
+ [12]=>
+ int(0)
+ [13]=>
+ int(0)
+ [14]=>
+ int(0)
+ [15]=>
+ int(0)
+ [16]=>
+ int(0)
+ [17]=>
+ int(0)
+ [18]=>
+ int(0)
+ [19]=>
+ int(0)
+ [20]=>
+ int(0)
+ [21]=>
+ int(0)
+ [22]=>
+ int(0)
+ [23]=>
+ int(0)
+ [24]=>
+ int(0)
+ [25]=>
+ int(0)
+ [26]=>
+ int(0)
+ [27]=>
+ int(0)
+ [28]=>
+ int(0)
+ [29]=>
+ int(0)
+ [30]=>
+ int(0)
+ [31]=>
+ int(0)
+ [32]=>
+ int(7)
+ [33]=>
+ int(0)
+ [34]=>
+ int(0)
+ [35]=>
+ int(0)
+ [36]=>
+ int(0)
+ [37]=>
+ int(0)
+ [38]=>
+ int(0)
+ [39]=>
+ int(0)
+ [40]=>
+ int(0)
+ [41]=>
+ int(0)
+ [42]=>
+ int(0)
+ [43]=>
+ int(0)
+ [44]=>
+ int(0)
+ [45]=>
+ int(0)
+ [46]=>
+ int(0)
+ [47]=>
+ int(0)
+ [48]=>
+ int(0)
+ [49]=>
+ int(0)
+ [50]=>
+ int(0)
+ [51]=>
+ int(0)
+ [52]=>
+ int(0)
+ [53]=>
+ int(0)
+ [54]=>
+ int(0)
+ [55]=>
+ int(0)
+ [56]=>
+ int(0)
+ [57]=>
+ int(0)
+ [58]=>
+ int(0)
+ [59]=>
+ int(0)
+ [60]=>
+ int(0)
+ [61]=>
+ int(0)
+ [62]=>
+ int(0)
+ [63]=>
+ int(0)
+ [64]=>
+ int(0)
+ [65]=>
+ int(0)
+ [66]=>
+ int(0)
+ [67]=>
+ int(0)
+ [68]=>
+ int(0)
+ [69]=>
+ int(0)
+ [70]=>
+ int(0)
+ [71]=>
+ int(0)
+ [72]=>
+ int(0)
+ [73]=>
+ int(0)
+ [74]=>
+ int(0)
+ [75]=>
+ int(0)
+ [76]=>
+ int(0)
+ [77]=>
+ int(0)
+ [78]=>
+ int(0)
+ [79]=>
+ int(0)
+ [80]=>
+ int(0)
+ [81]=>
+ int(0)
+ [82]=>
+ int(1)
+ [83]=>
+ int(0)
+ [84]=>
+ int(0)
+ [85]=>
+ int(0)
+ [86]=>
+ int(0)
+ [87]=>
+ int(0)
+ [88]=>
+ int(0)
+ [89]=>
+ int(0)
+ [90]=>
+ int(0)
+ [91]=>
+ int(0)
+ [92]=>
+ int(0)
+ [93]=>
+ int(0)
+ [94]=>
+ int(0)
+ [95]=>
+ int(0)
+ [96]=>
+ int(0)
+ [97]=>
+ int(5)
+ [98]=>
+ int(1)
+ [99]=>
+ int(2)
+ [100]=>
+ int(1)
+ [101]=>
+ int(3)
+ [102]=>
+ int(1)
+ [103]=>
+ int(1)
+ [104]=>
+ int(1)
+ [105]=>
+ int(4)
+ [106]=>
+ int(0)
+ [107]=>
+ int(0)
+ [108]=>
+ int(0)
+ [109]=>
+ int(1)
+ [110]=>
+ int(5)
+ [111]=>
+ int(3)
+ [112]=>
+ int(0)
+ [113]=>
+ int(0)
+ [114]=>
+ int(5)
+ [115]=>
+ int(3)
+ [116]=>
+ int(5)
+ [117]=>
+ int(3)
+ [118]=>
+ int(0)
+ [119]=>
+ int(0)
+ [120]=>
+ int(0)
+ [121]=>
+ int(0)
+ [122]=>
+ int(0)
+ [123]=>
+ int(0)
+ [124]=>
+ int(0)
+ [125]=>
+ int(0)
+ [126]=>
+ int(0)
+ [127]=>
+ int(0)
+ [128]=>
+ int(0)
+ [129]=>
+ int(0)
+ [130]=>
+ int(0)
+ [131]=>
+ int(0)
+ [132]=>
+ int(0)
+ [133]=>
+ int(0)
+ [134]=>
+ int(0)
+ [135]=>
+ int(0)
+ [136]=>
+ int(0)
+ [137]=>
+ int(0)
+ [138]=>
+ int(0)
+ [139]=>
+ int(0)
+ [140]=>
+ int(0)
+ [141]=>
+ int(0)
+ [142]=>
+ int(0)
+ [143]=>
+ int(0)
+ [144]=>
+ int(0)
+ [145]=>
+ int(0)
+ [146]=>
+ int(0)
+ [147]=>
+ int(0)
+ [148]=>
+ int(0)
+ [149]=>
+ int(0)
+ [150]=>
+ int(0)
+ [151]=>
+ int(0)
+ [152]=>
+ int(0)
+ [153]=>
+ int(0)
+ [154]=>
+ int(0)
+ [155]=>
+ int(0)
+ [156]=>
+ int(0)
+ [157]=>
+ int(0)
+ [158]=>
+ int(0)
+ [159]=>
+ int(0)
+ [160]=>
+ int(0)
+ [161]=>
+ int(0)
+ [162]=>
+ int(0)
+ [163]=>
+ int(0)
+ [164]=>
+ int(0)
+ [165]=>
+ int(0)
+ [166]=>
+ int(0)
+ [167]=>
+ int(0)
+ [168]=>
+ int(0)
+ [169]=>
+ int(0)
+ [170]=>
+ int(0)
+ [171]=>
+ int(0)
+ [172]=>
+ int(0)
+ [173]=>
+ int(0)
+ [174]=>
+ int(0)
+ [175]=>
+ int(0)
+ [176]=>
+ int(0)
+ [177]=>
+ int(0)
+ [178]=>
+ int(0)
+ [179]=>
+ int(0)
+ [180]=>
+ int(0)
+ [181]=>
+ int(0)
+ [182]=>
+ int(0)
+ [183]=>
+ int(0)
+ [184]=>
+ int(0)
+ [185]=>
+ int(0)
+ [186]=>
+ int(0)
+ [187]=>
+ int(0)
+ [188]=>
+ int(0)
+ [189]=>
+ int(0)
+ [190]=>
+ int(0)
+ [191]=>
+ int(0)
+ [192]=>
+ int(0)
+ [193]=>
+ int(0)
+ [194]=>
+ int(0)
+ [195]=>
+ int(0)
+ [196]=>
+ int(0)
+ [197]=>
+ int(0)
+ [198]=>
+ int(0)
+ [199]=>
+ int(0)
+ [200]=>
+ int(0)
+ [201]=>
+ int(0)
+ [202]=>
+ int(0)
+ [203]=>
+ int(0)
+ [204]=>
+ int(0)
+ [205]=>
+ int(0)
+ [206]=>
+ int(0)
+ [207]=>
+ int(0)
+ [208]=>
+ int(0)
+ [209]=>
+ int(0)
+ [210]=>
+ int(0)
+ [211]=>
+ int(0)
+ [212]=>
+ int(0)
+ [213]=>
+ int(0)
+ [214]=>
+ int(0)
+ [215]=>
+ int(0)
+ [216]=>
+ int(0)
+ [217]=>
+ int(0)
+ [218]=>
+ int(0)
+ [219]=>
+ int(0)
+ [220]=>
+ int(0)
+ [221]=>
+ int(0)
+ [222]=>
+ int(0)
+ [223]=>
+ int(0)
+ [224]=>
+ int(0)
+ [225]=>
+ int(0)
+ [226]=>
+ int(0)
+ [227]=>
+ int(0)
+ [228]=>
+ int(0)
+ [229]=>
+ int(0)
+ [230]=>
+ int(0)
+ [231]=>
+ int(0)
+ [232]=>
+ int(0)
+ [233]=>
+ int(0)
+ [234]=>
+ int(0)
+ [235]=>
+ int(0)
+ [236]=>
+ int(0)
+ [237]=>
+ int(0)
+ [238]=>
+ int(0)
+ [239]=>
+ int(0)
+ [240]=>
+ int(0)
+ [241]=>
+ int(0)
+ [242]=>
+ int(0)
+ [243]=>
+ int(0)
+ [244]=>
+ int(0)
+ [245]=>
+ int(0)
+ [246]=>
+ int(0)
+ [247]=>
+ int(0)
+ [248]=>
+ int(0)
+ [249]=>
+ int(0)
+ [250]=>
+ int(0)
+ [251]=>
+ int(0)
+ [252]=>
+ int(0)
+ [253]=>
+ int(0)
+ [254]=>
+ int(0)
+ [255]=>
+ int(0)
+}
+array(18) {
+ [32]=>
+ int(7)
+ [82]=>
+ int(1)
+ [97]=>
+ int(5)
+ [98]=>
+ int(1)
+ [99]=>
+ int(2)
+ [100]=>
+ int(1)
+ [101]=>
+ int(3)
+ [102]=>
+ int(1)
+ [103]=>
+ int(1)
+ [104]=>
+ int(1)
+ [105]=>
+ int(4)
+ [109]=>
+ int(1)
+ [110]=>
+ int(5)
+ [111]=>
+ int(3)
+ [114]=>
+ int(5)
+ [115]=>
+ int(3)
+ [116]=>
+ int(5)
+ [117]=>
+ int(3)
+}
+array(238) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(0)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+ [9]=>
+ int(0)
+ [10]=>
+ int(0)
+ [11]=>
+ int(0)
+ [12]=>
+ int(0)
+ [13]=>
+ int(0)
+ [14]=>
+ int(0)
+ [15]=>
+ int(0)
+ [16]=>
+ int(0)
+ [17]=>
+ int(0)
+ [18]=>
+ int(0)
+ [19]=>
+ int(0)
+ [20]=>
+ int(0)
+ [21]=>
+ int(0)
+ [22]=>
+ int(0)
+ [23]=>
+ int(0)
+ [24]=>
+ int(0)
+ [25]=>
+ int(0)
+ [26]=>
+ int(0)
+ [27]=>
+ int(0)
+ [28]=>
+ int(0)
+ [29]=>
+ int(0)
+ [30]=>
+ int(0)
+ [31]=>
+ int(0)
+ [33]=>
+ int(0)
+ [34]=>
+ int(0)
+ [35]=>
+ int(0)
+ [36]=>
+ int(0)
+ [37]=>
+ int(0)
+ [38]=>
+ int(0)
+ [39]=>
+ int(0)
+ [40]=>
+ int(0)
+ [41]=>
+ int(0)
+ [42]=>
+ int(0)
+ [43]=>
+ int(0)
+ [44]=>
+ int(0)
+ [45]=>
+ int(0)
+ [46]=>
+ int(0)
+ [47]=>
+ int(0)
+ [48]=>
+ int(0)
+ [49]=>
+ int(0)
+ [50]=>
+ int(0)
+ [51]=>
+ int(0)
+ [52]=>
+ int(0)
+ [53]=>
+ int(0)
+ [54]=>
+ int(0)
+ [55]=>
+ int(0)
+ [56]=>
+ int(0)
+ [57]=>
+ int(0)
+ [58]=>
+ int(0)
+ [59]=>
+ int(0)
+ [60]=>
+ int(0)
+ [61]=>
+ int(0)
+ [62]=>
+ int(0)
+ [63]=>
+ int(0)
+ [64]=>
+ int(0)
+ [65]=>
+ int(0)
+ [66]=>
+ int(0)
+ [67]=>
+ int(0)
+ [68]=>
+ int(0)
+ [69]=>
+ int(0)
+ [70]=>
+ int(0)
+ [71]=>
+ int(0)
+ [72]=>
+ int(0)
+ [73]=>
+ int(0)
+ [74]=>
+ int(0)
+ [75]=>
+ int(0)
+ [76]=>
+ int(0)
+ [77]=>
+ int(0)
+ [78]=>
+ int(0)
+ [79]=>
+ int(0)
+ [80]=>
+ int(0)
+ [81]=>
+ int(0)
+ [83]=>
+ int(0)
+ [84]=>
+ int(0)
+ [85]=>
+ int(0)
+ [86]=>
+ int(0)
+ [87]=>
+ int(0)
+ [88]=>
+ int(0)
+ [89]=>
+ int(0)
+ [90]=>
+ int(0)
+ [91]=>
+ int(0)
+ [92]=>
+ int(0)
+ [93]=>
+ int(0)
+ [94]=>
+ int(0)
+ [95]=>
+ int(0)
+ [96]=>
+ int(0)
+ [106]=>
+ int(0)
+ [107]=>
+ int(0)
+ [108]=>
+ int(0)
+ [112]=>
+ int(0)
+ [113]=>
+ int(0)
+ [118]=>
+ int(0)
+ [119]=>
+ int(0)
+ [120]=>
+ int(0)
+ [121]=>
+ int(0)
+ [122]=>
+ int(0)
+ [123]=>
+ int(0)
+ [124]=>
+ int(0)
+ [125]=>
+ int(0)
+ [126]=>
+ int(0)
+ [127]=>
+ int(0)
+ [128]=>
+ int(0)
+ [129]=>
+ int(0)
+ [130]=>
+ int(0)
+ [131]=>
+ int(0)
+ [132]=>
+ int(0)
+ [133]=>
+ int(0)
+ [134]=>
+ int(0)
+ [135]=>
+ int(0)
+ [136]=>
+ int(0)
+ [137]=>
+ int(0)
+ [138]=>
+ int(0)
+ [139]=>
+ int(0)
+ [140]=>
+ int(0)
+ [141]=>
+ int(0)
+ [142]=>
+ int(0)
+ [143]=>
+ int(0)
+ [144]=>
+ int(0)
+ [145]=>
+ int(0)
+ [146]=>
+ int(0)
+ [147]=>
+ int(0)
+ [148]=>
+ int(0)
+ [149]=>
+ int(0)
+ [150]=>
+ int(0)
+ [151]=>
+ int(0)
+ [152]=>
+ int(0)
+ [153]=>
+ int(0)
+ [154]=>
+ int(0)
+ [155]=>
+ int(0)
+ [156]=>
+ int(0)
+ [157]=>
+ int(0)
+ [158]=>
+ int(0)
+ [159]=>
+ int(0)
+ [160]=>
+ int(0)
+ [161]=>
+ int(0)
+ [162]=>
+ int(0)
+ [163]=>
+ int(0)
+ [164]=>
+ int(0)
+ [165]=>
+ int(0)
+ [166]=>
+ int(0)
+ [167]=>
+ int(0)
+ [168]=>
+ int(0)
+ [169]=>
+ int(0)
+ [170]=>
+ int(0)
+ [171]=>
+ int(0)
+ [172]=>
+ int(0)
+ [173]=>
+ int(0)
+ [174]=>
+ int(0)
+ [175]=>
+ int(0)
+ [176]=>
+ int(0)
+ [177]=>
+ int(0)
+ [178]=>
+ int(0)
+ [179]=>
+ int(0)
+ [180]=>
+ int(0)
+ [181]=>
+ int(0)
+ [182]=>
+ int(0)
+ [183]=>
+ int(0)
+ [184]=>
+ int(0)
+ [185]=>
+ int(0)
+ [186]=>
+ int(0)
+ [187]=>
+ int(0)
+ [188]=>
+ int(0)
+ [189]=>
+ int(0)
+ [190]=>
+ int(0)
+ [191]=>
+ int(0)
+ [192]=>
+ int(0)
+ [193]=>
+ int(0)
+ [194]=>
+ int(0)
+ [195]=>
+ int(0)
+ [196]=>
+ int(0)
+ [197]=>
+ int(0)
+ [198]=>
+ int(0)
+ [199]=>
+ int(0)
+ [200]=>
+ int(0)
+ [201]=>
+ int(0)
+ [202]=>
+ int(0)
+ [203]=>
+ int(0)
+ [204]=>
+ int(0)
+ [205]=>
+ int(0)
+ [206]=>
+ int(0)
+ [207]=>
+ int(0)
+ [208]=>
+ int(0)
+ [209]=>
+ int(0)
+ [210]=>
+ int(0)
+ [211]=>
+ int(0)
+ [212]=>
+ int(0)
+ [213]=>
+ int(0)
+ [214]=>
+ int(0)
+ [215]=>
+ int(0)
+ [216]=>
+ int(0)
+ [217]=>
+ int(0)
+ [218]=>
+ int(0)
+ [219]=>
+ int(0)
+ [220]=>
+ int(0)
+ [221]=>
+ int(0)
+ [222]=>
+ int(0)
+ [223]=>
+ int(0)
+ [224]=>
+ int(0)
+ [225]=>
+ int(0)
+ [226]=>
+ int(0)
+ [227]=>
+ int(0)
+ [228]=>
+ int(0)
+ [229]=>
+ int(0)
+ [230]=>
+ int(0)
+ [231]=>
+ int(0)
+ [232]=>
+ int(0)
+ [233]=>
+ int(0)
+ [234]=>
+ int(0)
+ [235]=>
+ int(0)
+ [236]=>
+ int(0)
+ [237]=>
+ int(0)
+ [238]=>
+ int(0)
+ [239]=>
+ int(0)
+ [240]=>
+ int(0)
+ [241]=>
+ int(0)
+ [242]=>
+ int(0)
+ [243]=>
+ int(0)
+ [244]=>
+ int(0)
+ [245]=>
+ int(0)
+ [246]=>
+ int(0)
+ [247]=>
+ int(0)
+ [248]=>
+ int(0)
+ [249]=>
+ int(0)
+ [250]=>
+ int(0)
+ [251]=>
+ int(0)
+ [252]=>
+ int(0)
+ [253]=>
+ int(0)
+ [254]=>
+ int(0)
+ [255]=>
+ int(0)
+}
+string(18) " Rabcdefghimnorstu"
+string(476) "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f5051535455565758595a5b5c5d5e5f606a6b6c7071767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
+===DONE===
--- /dev/null
+--TEST--
+Test count_chars() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : mixed count_chars ( string $string [, int $mode ] )
+ * Description: Return information about characters used in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing count_chars() : error conditions ***\n";
+
+echo "\n-- Testing count_chars() function with no arguments --\n";
+var_dump( count_chars() );
+
+echo "\n-- Testing count_chars() function with more than expected no. of arguments --\n";
+$string = "Hello World\n";
+$mode = 1;
+$extra_arg = 10;
+var_dump( count_chars($string, $mode, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing count_chars() : error conditions ***
+
+-- Testing count_chars() function with no arguments --
+
+Warning: Wrong parameter count for count_chars() in %s on line %d
+NULL
+
+-- Testing count_chars() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for count_chars() in %s on line %d
+NULL
+===DONE===
--- /dev/null
+--TEST--
+Test count_chars() function : usage variations - test values for $string argument
+--FILE--
+<?php
+
+/* Prototype : mixed count_chars ( string $string [, int $mode ] )
+ * Description: Return information about characters used in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing count_chars() function: with unexpected inputs for 'string' argument ***\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 for $input
+$inputs = array (
+
+ // integer values
+/* 1 */ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/* 7 */ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/* 10 */ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/* 13 */ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/* 17 */ NULL,
+ null,
+
+ // objects
+/* 19 */ new sample(),
+
+ // resource
+/* 20 */ $file_handle,
+
+ // undefined variable
+/* 21 */ @$undefined_var,
+
+ // unset variable
+/* 22 */ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test count_chars() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ // only list characters with a frequency > 0
+ var_dump(count_chars($input, 1));
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing count_chars() function: with unexpected inputs for 'string' argument ***
+-- Iteration 1 --
+array(1) {
+ [48]=>
+ int(1)
+}
+-- Iteration 2 --
+array(1) {
+ [49]=>
+ int(1)
+}
+-- Iteration 3 --
+array(2) {
+ [50]=>
+ int(1)
+ [53]=>
+ int(2)
+}
+-- Iteration 4 --
+array(3) {
+ [50]=>
+ int(1)
+ [53]=>
+ int(1)
+ [54]=>
+ int(1)
+}
+-- Iteration 5 --
+array(7) {
+ [49]=>
+ int(1)
+ [50]=>
+ int(1)
+ [51]=>
+ int(1)
+ [52]=>
+ int(3)
+ [54]=>
+ int(1)
+ [55]=>
+ int(2)
+ [56]=>
+ int(1)
+}
+-- Iteration 6 --
+array(8) {
+ [45]=>
+ int(1)
+ [49]=>
+ int(1)
+ [50]=>
+ int(1)
+ [51]=>
+ int(1)
+ [52]=>
+ int(3)
+ [54]=>
+ int(1)
+ [55]=>
+ int(1)
+ [56]=>
+ int(2)
+}
+-- Iteration 7 --
+array(4) {
+ [46]=>
+ int(1)
+ [48]=>
+ int(1)
+ [49]=>
+ int(1)
+ [53]=>
+ int(1)
+}
+-- Iteration 8 --
+array(5) {
+ [45]=>
+ int(1)
+ [46]=>
+ int(1)
+ [48]=>
+ int(1)
+ [50]=>
+ int(1)
+ [53]=>
+ int(1)
+}
+-- Iteration 9 --
+array(8) {
+ [48]=>
+ int(4)
+ [49]=>
+ int(2)
+ [50]=>
+ int(1)
+ [51]=>
+ int(1)
+ [52]=>
+ int(1)
+ [53]=>
+ int(1)
+ [54]=>
+ int(1)
+ [55]=>
+ int(1)
+}
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+array(4) {
+ [65]=>
+ int(1)
+ [97]=>
+ int(1)
+ [114]=>
+ int(2)
+ [121]=>
+ int(1)
+}
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+array(4) {
+ [65]=>
+ int(1)
+ [97]=>
+ int(1)
+ [114]=>
+ int(2)
+ [121]=>
+ int(1)
+}
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+array(4) {
+ [65]=>
+ int(1)
+ [97]=>
+ int(1)
+ [114]=>
+ int(2)
+ [121]=>
+ int(1)
+}
+-- Iteration 13 --
+array(1) {
+ [49]=>
+ int(1)
+}
+-- Iteration 14 --
+array(0) {
+}
+-- Iteration 15 --
+array(1) {
+ [49]=>
+ int(1)
+}
+-- Iteration 16 --
+array(0) {
+}
+-- Iteration 17 --
+array(0) {
+}
+-- Iteration 18 --
+array(0) {
+}
+-- Iteration 19 --
+array(12) {
+ [32]=>
+ int(1)
+ [97]=>
+ int(1)
+ [98]=>
+ int(1)
+ [99]=>
+ int(1)
+ [101]=>
+ int(2)
+ [106]=>
+ int(1)
+ [108]=>
+ int(1)
+ [109]=>
+ int(1)
+ [111]=>
+ int(1)
+ [112]=>
+ int(1)
+ [115]=>
+ int(1)
+ [116]=>
+ int(1)
+}
+-- Iteration 20 --
+array(%d) {
+ %a
+}
+-- Iteration 21 --
+array(0) {
+}
+-- Iteration 22 --
+array(0) {
+}
+===DONE===
--- /dev/null
+--TEST--
+Test count_chars() function : usage variations - test values for $mode argument
+--FILE--
+<?php
+
+/* Prototype : mixed count_chars ( string $string [, int $mode ] )
+ * Description: Return information about characters used in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing count_chars() function: with unexpected inputs for 'mode' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+}
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/* 1 */ 0,
+ 1,
+ 255,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/* 6 */ 0.0,
+ 1.3,
+ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/* 11 */ array(),
+ array(1, 2, 3, 4, 5, 6, 7, 8, 9),
+
+ // boolean values
+/* 14 */ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/* 18 */ NULL,
+ null,
+
+ // string values
+/* 20 */ "ABCD",
+ 'abcd',
+ "1ABC",
+ "5ABC",
+
+ // objects
+/* 24 */ new sample(),
+
+ // undefined variable
+/* 25 */ @$undefined_var,
+
+ // unset variable
+/* 26 */ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test count_chars() function
+// with unexepcted values for the 'mode' argument
+$count = 1;
+$string = "Return information about characters used in a string";
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ // only list characters with a frequency > 0
+ var_dump(is_array(count_chars($string, $input)));
+ $count ++;
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing count_chars() function: with unexpected inputs for 'mode' argument ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+bool(true)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+===DONE===