---TEST--\r
-Bug #55509 (segfault on x86_64 using more than 2G memory)\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE == 4) {\r
- die('skip Not for 32-bits OS');\r
-}\r
-\r
-$zend_mm_enabled = getenv("USE_ZEND_ALLOC");\r
-if ($zend_mm_enabled === "0") {\r
- die("skip Zend MM disabled");\r
-}\r
-\r
-if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");\r
-// check the available memory\r
-if (PHP_OS == 'Linux') {\r
- $lines = file('/proc/meminfo');\r
- $infos = array();\r
- foreach ($lines as $line) {\r
- $tmp = explode(":", $line);\r
- $index = strtolower($tmp[0]);\r
- $value = (int)ltrim($tmp[1], " ")*1024;\r
- $infos[$index] = $value;\r
- }\r
- $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];\r
- if ($freeMemory < 2100*1024*1024) {\r
- die('skip Not enough memory.');\r
- }\r
-}\r
-elseif (PHP_OS == 'FreeBSD') {\r
- $lines = explode("\n",`sysctl -a`);\r
- $infos = array();\r
- foreach ($lines as $line) {\r
- if(!$line){\r
- continue;\r
- }\r
- $tmp = explode(":", $line);\r
- $index = strtolower($tmp[0]);\r
- $value = trim($tmp[1], " ");\r
- $infos[$index] = $value;\r
- }\r
- $freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])\r
- +($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])\r
- +($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);\r
- if ($freeMemory < 2100*1024*1024) {\r
- die('skip Not enough memory.');\r
- }\r
-}\r
-?>\r
---INI--\r
-memory_limit=2100M\r
---FILE--\r
-<?php\r
-$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);\r
-echo "1\n";\r
-$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);\r
-echo "2\n";\r
-$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);\r
-echo "3\n";\r
-$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);\r
-echo "4\n";\r
-$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);\r
-echo "5\n";\r
-?>\r
---EXPECTF--\r
-1\r
-2\r
-3\r
-4\r
-\r
-Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d\r
+--TEST--
+Bug #55509 (segfault on x86_64 using more than 2G memory)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE == 4) {
+ die('skip Not for 32-bits OS');
+}
+
+$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
+if ($zend_mm_enabled === "0") {
+ die("skip Zend MM disabled");
+}
+
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+// check the available memory
+if (PHP_OS == 'Linux') {
+ $lines = file('/proc/meminfo');
+ $infos = array();
+ foreach ($lines as $line) {
+ $tmp = explode(":", $line);
+ $index = strtolower($tmp[0]);
+ $value = (int)ltrim($tmp[1], " ")*1024;
+ $infos[$index] = $value;
+ }
+ $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
+ if ($freeMemory < 2100*1024*1024) {
+ die('skip Not enough memory.');
+ }
+}
+elseif (PHP_OS == 'FreeBSD') {
+ $lines = explode("\n",`sysctl -a`);
+ $infos = array();
+ foreach ($lines as $line) {
+ if(!$line){
+ continue;
+ }
+ $tmp = explode(":", $line);
+ $index = strtolower($tmp[0]);
+ $value = trim($tmp[1], " ");
+ $infos[$index] = $value;
+ }
+ $freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])
+ +($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])
+ +($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);
+ if ($freeMemory < 2100*1024*1024) {
+ die('skip Not enough memory.');
+ }
+}
+?>
+--INI--
+memory_limit=2100M
+--FILE--
+<?php
+$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
+echo "1\n";
+$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
+echo "2\n";
+$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
+echo "3\n";
+$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
+echo "4\n";
+$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
+echo "5\n";
+?>
+--EXPECTF--
+1
+2
+3
+4
+
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d
---TEST--\r
-Bug #64979 (Wrong behavior of static variables in closure generators)\r
---FILE--\r
-<?php\r
-\r
-function new_closure_gen() {\r
- return function() {\r
- static $foo = 0;\r
- yield ++$foo;\r
- };\r
-}\r
-\r
-$closure1 = new_closure_gen();\r
-$closure2 = new_closure_gen();\r
-\r
-$gen1 = $closure1();\r
-$gen2 = $closure1();\r
-$gen3 = $closure2();\r
-\r
-foreach (array($gen1, $gen2, $gen3) as $gen) {\r
- foreach ($gen as $val) {\r
- var_dump($val);\r
- }\r
-}\r
-\r
-?>\r
---EXPECT--\r
-int(1)\r
-int(2)\r
-int(1)\r
+--TEST--
+Bug #64979 (Wrong behavior of static variables in closure generators)
+--FILE--
+<?php
+
+function new_closure_gen() {
+ return function() {
+ static $foo = 0;
+ yield ++$foo;
+ };
+}
+
+$closure1 = new_closure_gen();
+$closure2 = new_closure_gen();
+
+$gen1 = $closure1();
+$gen2 = $closure1();
+$gen3 = $closure2();
+
+foreach (array($gen1, $gen2, $gen3) as $gen) {
+ foreach ($gen as $val) {
+ var_dump($val);
+ }
+}
+
+?>
+--EXPECT--
+int(1)
+int(2)
+int(1)
---TEST--\r
-Bug #71474: Crash because of VM stack corruption on Magento2\r
---FILE--\r
-<?php\r
-class foo {\r
- function __call($name, $args) {\r
- $a = $b = $c = $d = $e = $f = 1;\r
- }\r
-}\r
-\r
-function test($n, $x) {\r
-// var_dump($n);\r
- if ($n > 0) {\r
- $x->bug();\r
- test($n - 1, $x);\r
- }\r
-}\r
-\r
-test(3000, new foo());\r
-echo "OK\n";\r
-?>\r
---EXPECT--\r
-OK\r
+--TEST--
+Bug #71474: Crash because of VM stack corruption on Magento2
+--FILE--
+<?php
+class foo {
+ function __call($name, $args) {
+ $a = $b = $c = $d = $e = $f = 1;
+ }
+}
+
+function test($n, $x) {
+// var_dump($n);
+ if ($n > 0) {
+ $x->bug();
+ test($n - 1, $x);
+ }
+}
+
+test(3000, new foo());
+echo "OK\n";
+?>
+--EXPECT--
+OK
---TEST--\r
-Bug #72918 (negative offset inside a quoted string leads to parse error)\r
---FILE--\r
-<?php\r
-$array = [-3 => 'foo'];\r
-$string = 'abcde';\r
-\r
-echo "$array[-3]\n";\r
-echo "$string[-3]\n";\r
-echo <<<EOT\r
-$array[-3]\r
-$string[-3]\r
-\r
-EOT;\r
-?>\r
-===DONE===\r
---EXPECT--\r
-foo\r
-c\r
-foo\r
-c\r
-===DONE===\r
+--TEST--
+Bug #72918 (negative offset inside a quoted string leads to parse error)
+--FILE--
+<?php
+$array = [-3 => 'foo'];
+$string = 'abcde';
+
+echo "$array[-3]\n";
+echo "$string[-3]\n";
+echo <<<EOT
+$array[-3]
+$string[-3]
+
+EOT;
+?>
+===DONE===
+--EXPECT--
+foo
+c
+foo
+c
+===DONE===
---TEST--\r
-string offset 002\r
---FILE--\r
-<?php\r
-$a = "aaa";\r
-$x = array(&$a[1]);\r
-?>\r
---EXPECTF--\r
-Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3\r
-Stack trace:\r
-#0 {main}\r
- thrown in %sstr_offset_002.php on line 3\r
+--TEST--
+string offset 002
+--FILE--
+<?php
+$a = "aaa";
+$x = array(&$a[1]);
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3
+Stack trace:
+#0 {main}
+ thrown in %sstr_offset_002.php on line 3
---TEST--\r
-Check for problems with case sensitivity in compositions\r
---FILE--\r
-<?php\r
-error_reporting(E_ALL);\r
-\r
-trait A {\r
- public function M1() {}\r
- public function M2() {}\r
-}\r
-\r
-trait B {\r
- public function M1() {}\r
- public function M2() {}\r
-}\r
-\r
-class MyClass {\r
- use A;\r
- use B;\r
-}\r
-?>\r
---EXPECTF--\r
-Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d\r
+--TEST--
+Check for problems with case sensitivity in compositions
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+trait A {
+ public function M1() {}
+ public function M2() {}
+}
+
+trait B {
+ public function M1() {}
+ public function M2() {}
+}
+
+class MyClass {
+ use A;
+ use B;
+}
+?>
+--EXPECTF--
+Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
---TEST--\r
-Traits with static methods.\r
---CREDITS--\r
-Simas Toleikis simast@gmail.com\r
---FILE--\r
-<?php\r
-\r
- trait TestTrait {\r
- public static function test() {\r
- return 'Test';\r
- }\r
- }\r
-\r
- class A {\r
- use TestTrait;\r
- }\r
-\r
- echo A::test();\r
-\r
-?>\r
---EXPECT--\r
+--TEST--
+Traits with static methods.
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return 'Test';
+ }
+ }
+
+ class A {
+ use TestTrait;
+ }
+
+ echo A::test();
+
+?>
+--EXPECT--
Test
\ No newline at end of file
---TEST--\r
-Traits with static methods referenced using variable.\r
---CREDITS--\r
-Simas Toleikis simast@gmail.com\r
---FILE--\r
-<?php\r
-\r
- trait TestTrait {\r
- public static function test() {\r
- return 'Test';\r
- }\r
- }\r
-\r
- class A {\r
- use TestTrait;\r
- }\r
-\r
- $class = "A";\r
- echo $class::test();\r
-\r
-?>\r
---EXPECT--\r
+--TEST--
+Traits with static methods referenced using variable.
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return 'Test';
+ }
+ }
+
+ class A {
+ use TestTrait;
+ }
+
+ $class = "A";
+ echo $class::test();
+
+?>
+--EXPECT--
Test
\ No newline at end of file
---TEST--\r
-Traits with late static bindings.\r
---CREDITS--\r
-Simas Toleikis simast@gmail.com\r
---FILE--\r
-<?php\r
-\r
- trait TestTrait {\r
- public static function test() {\r
- return static::$test;\r
- }\r
- }\r
-\r
- class A {\r
- use TestTrait;\r
- protected static $test = "Test A";\r
- }\r
-\r
- class B extends A {\r
- protected static $test = "Test B";\r
- }\r
-\r
- echo B::test();\r
-\r
-?>\r
---EXPECT--\r
+--TEST--
+Traits with late static bindings.
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return static::$test;
+ }
+ }
+
+ class A {
+ use TestTrait;
+ protected static $test = "Test A";
+ }
+
+ class B extends A {
+ protected static $test = "Test B";
+ }
+
+ echo B::test();
+
+?>
+--EXPECT--
Test B
\ No newline at end of file
---TEST--\r
-Traits with __callStatic magic method.\r
---CREDITS--\r
-Simas Toleikis simast@gmail.com\r
---FILE--\r
-<?php\r
-\r
- trait TestTrait {\r
- public static function __callStatic($name, $arguments) {\r
- return $name;\r
- }\r
- }\r
-\r
- class A {\r
- use TestTrait;\r
- }\r
-\r
- echo A::Test();\r
-\r
-?>\r
---EXPECT--\r
+--TEST--
+Traits with __callStatic magic method.
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function __callStatic($name, $arguments) {
+ return $name;
+ }
+ }
+
+ class A {
+ use TestTrait;
+ }
+
+ echo A::Test();
+
+?>
+--EXPECT--
Test
\ No newline at end of file
---TEST--\r
-Traits and forward_static_call().\r
---CREDITS--\r
-Simas Toleikis simast@gmail.com\r
---FILE--\r
-<?php\r
-\r
- trait TestTrait {\r
- public static function test() {\r
- return 'Forwarded '.forward_static_call(array('A', 'test'));\r
- }\r
- }\r
-\r
- class A {\r
- public static function test() {\r
- return "Test A";\r
- }\r
- }\r
-\r
- class B extends A {\r
- use TestTrait;\r
- }\r
-\r
- echo B::test();\r
-\r
-?>\r
---EXPECT--\r
+--TEST--
+Traits and forward_static_call().
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return 'Forwarded '.forward_static_call(array('A', 'test'));
+ }
+ }
+
+ class A {
+ public static function test() {
+ return "Test A";
+ }
+ }
+
+ class B extends A {
+ use TestTrait;
+ }
+
+ echo B::test();
+
+?>
+--EXPECT--
Forwarded Test A
\ No newline at end of file
---TEST--\r
-Traits and get_called_class().\r
---CREDITS--\r
-Simas Toleikis simast@gmail.com\r
---FILE--\r
-<?php\r
-\r
- trait TestTrait {\r
- public static function test() {\r
- return get_called_class();\r
- }\r
- }\r
-\r
- class A {\r
- use TestTrait;\r
- }\r
-\r
- class B extends A { }\r
-\r
- echo B::test();\r
-\r
-?>\r
---EXPECT--\r
+--TEST--
+Traits and get_called_class().
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return get_called_class();
+ }
+ }
+
+ class A {
+ use TestTrait;
+ }
+
+ class B extends A { }
+
+ echo B::test();
+
+?>
+--EXPECT--
B
\ No newline at end of file
---TEST--\r
-__TRAIT__: Basics, a constant denoiting the trait of definition.\r
---FILE--\r
-<?php\r
-\r
-trait TestTrait {\r
- public static function test() {\r
- return __TRAIT__;\r
- }\r
-}\r
-\r
-class Direct {\r
- use TestTrait;\r
-}\r
-\r
-class IndirectInheritance extends Direct {\r
- \r
-}\r
-\r
-trait TestTraitIndirect {\r
- use TestTrait;\r
-}\r
-\r
-class Indirect {\r
- use TestTraitIndirect;\r
-}\r
-\r
-echo Direct::test()."\n";\r
-echo IndirectInheritance::test()."\n";\r
-echo Indirect::test()."\n";\r
-\r
-?>\r
---EXPECT--\r
-TestTrait\r
-TestTrait\r
-TestTrait\r
+--TEST--
+__TRAIT__: Basics, a constant denoiting the trait of definition.
+--FILE--
+<?php
+
+trait TestTrait {
+ public static function test() {
+ return __TRAIT__;
+ }
+}
+
+class Direct {
+ use TestTrait;
+}
+
+class IndirectInheritance extends Direct {
+
+}
+
+trait TestTraitIndirect {
+ use TestTrait;
+}
+
+class Indirect {
+ use TestTraitIndirect;
+}
+
+echo Direct::test()."\n";
+echo IndirectInheritance::test()."\n";
+echo Indirect::test()."\n";
+
+?>
+--EXPECT--
+TestTrait
+TestTrait
+TestTrait
---TEST--\r
-__TRAIT__: Use outside of traits.\r
---FILE--\r
-<?php\r
-\r
- class MyClass {\r
- static function test() {\r
- return __TRAIT__;\r
- }\r
- }\r
- \r
- function someFun() {\r
- return __TRAIT__;\r
- }\r
- \r
-\r
- $t = __TRAIT__;\r
- var_dump($t);\r
- $t = MyClass::test();\r
- var_dump($t);\r
- $t = someFun();\r
- var_dump($t);\r
-?>\r
---EXPECT--\r
-string(0) ""\r
-string(0) ""\r
+--TEST--
+__TRAIT__: Use outside of traits.
+--FILE--
+<?php
+
+ class MyClass {
+ static function test() {
+ return __TRAIT__;
+ }
+ }
+
+ function someFun() {
+ return __TRAIT__;
+ }
+
+
+ $t = __TRAIT__;
+ var_dump($t);
+ $t = MyClass::test();
+ var_dump($t);
+ $t = someFun();
+ var_dump($t);
+?>
+--EXPECT--
+string(0) ""
+string(0) ""
string(0) ""
\ No newline at end of file
---TEST--\r
-Test curl_version() function : error conditions\r
---SKIPIF--\r
-<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>\r
---FILE--\r
-<?php\r
-\r
-/* Prototype : array curl_version ([ int $age ] )\r
- * Description: Returns information about the cURL version.\r
- * Source code: ext/curl/interface.c\r
-*/\r
-\r
-echo "*** Testing curl_version() : error conditions ***\n";\r
-\r
-echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";\r
-$extra_arg = 10;\r
-var_dump( curl_version(1, $extra_arg) );\r
-\r
-?>\r
-===Done===\r
---EXPECTF--\r
-*** Testing curl_version() : error conditions ***\r
-\r
--- Testing curl_version() function with more than expected no. of arguments --\r
-\r
-Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d\r
-NULL\r
-===Done===\r
+--TEST--
+Test curl_version() function : error conditions
+--SKIPIF--
+<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
+--FILE--
+<?php
+
+/* Prototype : array curl_version ([ int $age ] )
+ * Description: Returns information about the cURL version.
+ * Source code: ext/curl/interface.c
+*/
+
+echo "*** Testing curl_version() : error conditions ***\n";
+
+echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( curl_version(1, $extra_arg) );
+
+?>
+===Done===
+--EXPECTF--
+*** Testing curl_version() : error conditions ***
+
+-- Testing curl_version() function with more than expected no. of arguments --
+
+Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+===Done===
---TEST--\r
-Test curl_version() function : usage variations - test values for $ascii argument\r
---SKIPIF--\r
-<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");\r
-if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>\r
---FILE--\r
-<?php\r
-\r
-/* Prototype : array curl_version ([ int $age ] )\r
- * Description: Returns information about the cURL version.\r
- * Source code: ext/curl/interface.c\r
-*/\r
-\r
-echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";\r
-\r
-//get an unset variable\r
-$unset_var = 'string_val';\r
-unset($unset_var);\r
-\r
-//defining a class\r
-class sample {\r
- public function __toString() {\r
- return "sample object";\r
- } \r
-}\r
-\r
-//getting the resource\r
-$file_handle = fopen(__FILE__, "r");\r
-\r
-// array with different values for $input\r
-$inputs = array (\r
-\r
- // integer values\r
- 0,\r
- 1,\r
- 255,\r
- 256,\r
- PHP_INT_MAX,\r
- -PHP_INT_MAX,\r
-\r
- // float values\r
- 10.5,\r
- -20.5,\r
- 10.1234567e10,\r
-\r
- // array values\r
- array(),\r
- array(0),\r
- array(1, 2),\r
- \r
- //string values\r
- "ABC",\r
- 'abc',\r
- "2abc",\r
-\r
- // boolean values\r
- true,\r
- false,\r
- TRUE,\r
- FALSE,\r
-\r
- // null values\r
- NULL,\r
- null,\r
-\r
- // objects\r
- new sample(),\r
-\r
- // resource\r
- $file_handle,\r
-\r
- // undefined variable\r
- @$undefined_var,\r
-\r
- // unset variable\r
- @$unset_var\r
-);\r
-\r
-// loop through with each element of the $inputs array to test curl_version() function\r
-$count = 1;\r
-foreach($inputs as $input) {\r
- echo "-- Iteration $count --\n";\r
- var_dump( is_array(curl_version($input)) );\r
- $count ++;\r
-}\r
-\r
-fclose($file_handle); //closing the file handle\r
-\r
-?>\r
-===Done===\r
---EXPECTF--\r
-*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\r
--- Iteration 1 --\r
-bool(true)\r
--- Iteration 2 --\r
-bool(true)\r
--- Iteration 3 --\r
-bool(true)\r
--- Iteration 4 --\r
-bool(true)\r
--- Iteration 5 --\r
-bool(true)\r
--- Iteration 6 --\r
-bool(true)\r
--- Iteration 7 --\r
-bool(true)\r
--- Iteration 8 --\r
-bool(true)\r
--- Iteration 9 --\r
-bool(true)\r
--- Iteration 10 --\r
-\r
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d\r
-bool(false)\r
--- Iteration 11 --\r
-\r
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d\r
-bool(false)\r
--- Iteration 12 --\r
-\r
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d\r
-bool(false)\r
--- Iteration 13 --\r
-\r
-Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d\r
-bool(false)\r
--- Iteration 14 --\r
-\r
-Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d\r
-bool(false)\r
--- Iteration 15 --\r
-\r
-Notice: A non well formed numeric value encountered in %s on line %d\r
-bool(true)\r
--- Iteration 16 --\r
-bool(true)\r
--- Iteration 17 --\r
-bool(true)\r
--- Iteration 18 --\r
-bool(true)\r
--- Iteration 19 --\r
-bool(true)\r
--- Iteration 20 --\r
-bool(true)\r
--- Iteration 21 --\r
-bool(true)\r
--- Iteration 22 --\r
-\r
-Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d\r
-bool(false)\r
--- Iteration 23 --\r
-\r
-Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d\r
-bool(false)\r
--- Iteration 24 --\r
-bool(true)\r
--- Iteration 25 --\r
-bool(true)\r
-===Done===\r
+--TEST--
+Test curl_version() function : usage variations - test values for $ascii argument
+--SKIPIF--
+<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
+if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
+--FILE--
+<?php
+
+/* Prototype : array curl_version ([ int $age ] )
+ * Description: Returns information about the cURL version.
+ * Source code: ext/curl/interface.c
+*/
+
+echo "*** Testing curl_version() function: with unexpected inputs for 'age' 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
+ 0,
+ 1,
+ 255,
+ 256,
+ PHP_INT_MAX,
+ -PHP_INT_MAX,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ //string values
+ "ABC",
+ 'abc',
+ "2abc",
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test curl_version() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( is_array(curl_version($input)) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===Done===
+--EXPECTF--
+*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+
+Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+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: curl_version() expects parameter 1 to be integer, object given in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
+bool(false)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+===Done===
---TEST--\r
-Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)\r
---SKIPIF--\r
-<?php if (!extension_loaded("filter")) die("skip"); ?>\r
---FILE--\r
-<?php\r
-var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));\r
-var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE));\r
-var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));\r
-var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));\r
-var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));\r
-var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));\r
-var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));\r
-var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));\r
-var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));\r
-var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));\r
-var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));\r
-var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));\r
-var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));\r
-var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));\r
-?>\r
---EXPECT-- \r
-string(7) "FC00::1"\r
-bool(false)\r
-string(2) "::"\r
-bool(false)\r
-string(3) "::1"\r
-bool(false)\r
-string(10) "fe8:5:6::1"\r
-bool(false)\r
-string(12) "2001:0db8::1"\r
-bool(false)\r
-string(5) "5f::1"\r
-bool(false)\r
-string(7) "3ff3::1"\r
-bool(false)\r
+--TEST--
+Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE));
+var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+?>
+--EXPECT--
+string(7) "FC00::1"
+bool(false)
+string(2) "::"
+bool(false)
+string(3) "::1"
+bool(false)
+string(10) "fe8:5:6::1"
+bool(false)
+string(12) "2001:0db8::1"
+bool(false)
+string(5) "5f::1"
+bool(false)
+string(7) "3ff3::1"
+bool(false)
---TEST--\r
-#49274, fatal error when an object does not implement toString\r
---SKIPIF--\r
-<?php if (!extension_loaded("filter")) die("skip"); ?>\r
---FILE--\r
-<?php\r
-var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));\r
-?>\r
---EXPECTF-- \r
-bool(false)\r
+--TEST--
+#49274, fatal error when an object does not implement toString
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));
+?>
+--EXPECTF--
+bool(false)
---TEST--\r
-Bug #42434 (ImageLine w/ antialias = 1px shorter)\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) {\r
- die('skip gd extension not available');\r
-}\r
-if (!GD_BUNDLED) die("skip requires bundled GD library\n");\r
-?>\r
---FILE--\r
-<?php\r
-$im = imagecreatetruecolor(10, 2);\r
-imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);\r
-\r
-imageantialias($im, true);\r
-imageline($im, 0, 0, 10, 0, 0x000000);\r
-\r
-if (imagecolorat($im, 9, 0) == 0x000000) {\r
- echo 'DONE';\r
-} else {\r
- echo 'Bugged';\r
-}\r
-\r
-imagedestroy($im);\r
-?>\r
---EXPECTF--\r
+--TEST--
+Bug #42434 (ImageLine w/ antialias = 1px shorter)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) {
+ die('skip gd extension not available');
+}
+if (!GD_BUNDLED) die("skip requires bundled GD library\n");
+?>
+--FILE--
+<?php
+$im = imagecreatetruecolor(10, 2);
+imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
+
+imageantialias($im, true);
+imageline($im, 0, 0, 10, 0, 0x000000);
+
+if (imagecolorat($im, 9, 0) == 0x000000) {
+ echo 'DONE';
+} else {
+ echo 'Bugged';
+}
+
+imagedestroy($im);
+?>
+--EXPECTF--
DONE
\ No newline at end of file
---TEST--\r
-Bug #47946 (ImageConvolution overwrites background)\r
---DESCRIPTION--\r
-The expected image has black pixel artifacts, what is another issue, though\r
-(perhaps #40158).\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-?>\r
---FILE--\r
-<?php\r
-function array_flatten($array)\r
-{\r
- $tempArray = array();\r
-\r
- foreach ($array as $value) {\r
- if (is_array($value)) {\r
- $tempArray = array_merge($tempArray, array_flatten($value));\r
- } else {\r
- $tempArray[] = $value;\r
- }\r
- }\r
-\r
- return $tempArray;\r
-}\r
-\r
-function makeFilter($resource, $matrix, $offset = 1.0)\r
-{\r
- $divisor = array_sum(array_flatten($matrix));\r
- if ($divisor == 0) {\r
- $divisor = .01;\r
- }\r
- return imageconvolution($resource, $matrix, $divisor, $offset);\r
-}\r
-\r
-$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));\r
-\r
-$im = imagecreatetruecolor(40, 40);\r
-imagealphablending($im, false);\r
-imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);\r
-imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);\r
-imagesavealpha($im, true);\r
-makeFilter($im, $edgeMatrix);\r
-\r
-require_once __DIR__ . '/func.inc';\r
-test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);\r
-?>\r
-===DONE===\r
---EXPECT--\r
-The images are equal.\r
-===DONE===\r
+--TEST--
+Bug #47946 (ImageConvolution overwrites background)
+--DESCRIPTION--
+The expected image has black pixel artifacts, what is another issue, though
+(perhaps #40158).
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+function array_flatten($array)
+{
+ $tempArray = array();
+
+ foreach ($array as $value) {
+ if (is_array($value)) {
+ $tempArray = array_merge($tempArray, array_flatten($value));
+ } else {
+ $tempArray[] = $value;
+ }
+ }
+
+ return $tempArray;
+}
+
+function makeFilter($resource, $matrix, $offset = 1.0)
+{
+ $divisor = array_sum(array_flatten($matrix));
+ if ($divisor == 0) {
+ $divisor = .01;
+ }
+ return imageconvolution($resource, $matrix, $divisor, $offset);
+}
+
+$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
+
+$im = imagecreatetruecolor(40, 40);
+imagealphablending($im, false);
+imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);
+imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);
+imagesavealpha($im, true);
+makeFilter($im, $edgeMatrix);
+
+require_once __DIR__ . '/func.inc';
+test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
+?>
+===DONE===
+--EXPECT--
+The images are equal.
+===DONE===
---TEST--\r
-Bug #52070 (imagedashedline() - dashed line sometimes is not visible)\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-?>\r
---FILE--\r
-<?php\r
-$im = imagecreate(1200, 800);\r
-$background_color = imagecolorallocate($im, 40, 40, 40);\r
-$color = imagecolorallocate($im, 255, 255, 255);\r
-imagedashedline($im, 800, 400, 300, 400, $color);\r
-imagedashedline($im, 800, 400, 300, 800, $color);\r
-imagedashedline($im, 800, 400, 400, 800, $color);\r
-imagedashedline($im, 800, 400, 500, 800, $color);\r
-imagedashedline($im, 800, 400, 600, 800, $color);\r
-imagedashedline($im, 800, 400, 700, 800, $color);\r
-imagedashedline($im, 800, 400, 800, 800, $color);\r
-include_once __DIR__ . '/func.inc';\r
-test_image_equals_file(__DIR__ . '/bug52070.png', $im);\r
-?>\r
-===DONE===\r
---EXPECT--\r
-The images are equal.\r
-===DONE===\r
+--TEST--
+Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$im = imagecreate(1200, 800);
+$background_color = imagecolorallocate($im, 40, 40, 40);
+$color = imagecolorallocate($im, 255, 255, 255);
+imagedashedline($im, 800, 400, 300, 400, $color);
+imagedashedline($im, 800, 400, 300, 800, $color);
+imagedashedline($im, 800, 400, 400, 800, $color);
+imagedashedline($im, 800, 400, 500, 800, $color);
+imagedashedline($im, 800, 400, 600, 800, $color);
+imagedashedline($im, 800, 400, 700, 800, $color);
+imagedashedline($im, 800, 400, 800, 800, $color);
+include_once __DIR__ . '/func.inc';
+test_image_equals_file(__DIR__ . '/bug52070.png', $im);
+?>
+===DONE===
+--EXPECT--
+The images are equal.
+===DONE===
---TEST--\r
-Bug #53156 (imagerectangle problem with point ordering)\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {\r
- die("skip test requires GD 2.3 or newer");\r
-}\r
-?>\r
---FILE--\r
-<?php\r
-function draw_and_check_pixel($x, $y)\r
-{\r
- global $img, $black, $red;\r
- \r
- echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';\r
- imagesetpixel($img, $x, $y, $red);\r
-}\r
-\r
-function draw_and_check_rectangle($x1, $y1, $x2, $y2)\r
-{\r
- global $img, $black;\r
- \r
- echo 'Rectangle: ';\r
- imagerectangle($img, $x1, $y1, $x2, $y2, $black);\r
- $x = ($x1 + $x2) / 2;\r
- $y = ($y1 + $y2) / 2;\r
- draw_and_check_pixel($x, $y1);\r
- draw_and_check_pixel($x1, $y);\r
- draw_and_check_pixel($x, $y2);\r
- draw_and_check_pixel($x2, $y);\r
- echo PHP_EOL;\r
-}\r
-\r
-$img = imagecreate(110, 210);\r
-$bgnd = imagecolorallocate($img, 255, 255, 255);\r
-$black = imagecolorallocate($img, 0, 0, 0);\r
-$red = imagecolorallocate($img, 255, 0, 0);\r
-\r
-draw_and_check_rectangle( 10, 10, 50, 50);\r
-draw_and_check_rectangle( 50, 60, 10, 100);\r
-draw_and_check_rectangle( 50, 150, 10, 110);\r
-draw_and_check_rectangle( 10, 200, 50, 160);\r
-imagesetthickness($img, 4);\r
-draw_and_check_rectangle( 60, 10, 100, 50);\r
-draw_and_check_rectangle(100, 60, 60, 100);\r
-draw_and_check_rectangle(100, 150, 60, 110);\r
-draw_and_check_rectangle( 60, 200, 100, 160);\r
-\r
-//imagepng($img, __DIR__ . '/bug53156.png'); // debug\r
-?>\r
---EXPECT--\r
-Rectangle: ++++\r
-Rectangle: ++++\r
-Rectangle: ++++\r
-Rectangle: ++++\r
-Rectangle: ++++\r
-Rectangle: ++++\r
-Rectangle: ++++\r
-Rectangle: ++++\r
+--TEST--
+Bug #53156 (imagerectangle problem with point ordering)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
+ die("skip test requires GD 2.3 or newer");
+}
+?>
+--FILE--
+<?php
+function draw_and_check_pixel($x, $y)
+{
+ global $img, $black, $red;
+
+ echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
+ imagesetpixel($img, $x, $y, $red);
+}
+
+function draw_and_check_rectangle($x1, $y1, $x2, $y2)
+{
+ global $img, $black;
+
+ echo 'Rectangle: ';
+ imagerectangle($img, $x1, $y1, $x2, $y2, $black);
+ $x = ($x1 + $x2) / 2;
+ $y = ($y1 + $y2) / 2;
+ draw_and_check_pixel($x, $y1);
+ draw_and_check_pixel($x1, $y);
+ draw_and_check_pixel($x, $y2);
+ draw_and_check_pixel($x2, $y);
+ echo PHP_EOL;
+}
+
+$img = imagecreate(110, 210);
+$bgnd = imagecolorallocate($img, 255, 255, 255);
+$black = imagecolorallocate($img, 0, 0, 0);
+$red = imagecolorallocate($img, 255, 0, 0);
+
+draw_and_check_rectangle( 10, 10, 50, 50);
+draw_and_check_rectangle( 50, 60, 10, 100);
+draw_and_check_rectangle( 50, 150, 10, 110);
+draw_and_check_rectangle( 10, 200, 50, 160);
+imagesetthickness($img, 4);
+draw_and_check_rectangle( 60, 10, 100, 50);
+draw_and_check_rectangle(100, 60, 60, 100);
+draw_and_check_rectangle(100, 150, 60, 110);
+draw_and_check_rectangle( 60, 200, 100, 160);
+
+//imagepng($img, __DIR__ . '/bug53156.png'); // debug
+?>
+--EXPECT--
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
+Rectangle: ++++
---TEST--\r
-Bug #72494 (imagecropauto out-of-bounds access)\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-?>\r
---FILE--\r
-<?php\r
-$im = imagecreate(10,10);\r
-imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d\r
-===DONE===\r
+--TEST--
+Bug #72494 (imagecropauto out-of-bounds access)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$im = imagecreate(10,10);
+imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
+?>
+===DONE===
+--EXPECTF--
+Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
+===DONE===
---TEST--\r
-Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-?>\r
---FILE--\r
-<?php\r
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';\r
-\r
-$src = imagecreatetruecolor(100, 100);\r
-imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);\r
-imageellipse($src, 49,49, 40,40, 0x000000);\r
-\r
-imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);\r
-imagescale($src, 200, 200, IMG_BILINEAR_FIXED);\r
-$dst = imagerotate($src, 60, 0xFFFFFF);\r
-\r
-test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);\r
-?>\r
-===DONE===\r
---EXPECT--\r
-The images are equal.\r
-===DONE===\r
+--TEST--
+Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
+
+$src = imagecreatetruecolor(100, 100);
+imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
+imageellipse($src, 49,49, 40,40, 0x000000);
+
+imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
+imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
+$dst = imagerotate($src, 60, 0xFFFFFF);
+
+test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
+?>
+===DONE===
+--EXPECT--
+The images are equal.
+===DONE===
---TEST--\r
-Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {\r
- die('skip only for bundled libgd or external libgd >= 2.2.4');\r
-}\r
-?>\r
---FILE--\r
-<?php\r
-$src = imagecreate(100, 100);\r
-imagecolorallocate($src, 255, 255, 255);\r
-$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);\r
-printf("color: %x\n", imagecolorat($dst, 99, 99));\r
-?>\r
-===DONE===\r
---EXPECT--\r
-color: ffffff\r
-===DONE===\r
+--TEST--
+Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
+ die('skip only for bundled libgd or external libgd >= 2.2.4');
+}
+?>
+--FILE--
+<?php
+$src = imagecreate(100, 100);
+imagecolorallocate($src, 255, 255, 255);
+$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
+printf("color: %x\n", imagecolorat($dst, 99, 99));
+?>
+===DONE===
+--EXPECT--
+color: ffffff
+===DONE===
---TEST--\r
-Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {\r
- die('skip only for external libgd < 2.2.4');\r
-}\r
-?>\r
---FILE--\r
-<?php\r
-$src = imagecreate(100, 100);\r
-imagecolorallocate($src, 255, 255, 255);\r
-$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);\r
-printf("color: %x\n", imagecolorat($dst, 99, 99));\r
-?>\r
-===DONE===\r
---XFAIL--\r
-Bug #330 has not yet been fixed\r
---EXPECT--\r
-color: ffffff\r
-===DONE===\r
+--TEST--
+Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
+ die('skip only for external libgd < 2.2.4');
+}
+?>
+--FILE--
+<?php
+$src = imagecreate(100, 100);
+imagecolorallocate($src, 255, 255, 255);
+$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
+printf("color: %x\n", imagecolorat($dst, 99, 99));
+?>
+===DONE===
+--XFAIL--
+Bug #330 has not yet been fixed
+--EXPECT--
+color: ffffff
+===DONE===
---TEST--\r
-Bug #73968 (Premature failing of XBM reading)\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-?>\r
---FILE--\r
-<?php\r
-$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');\r
-var_dump($im);\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-resource(%d) of type (gd)\r
-===DONE===\r
+--TEST--
+Bug #73968 (Premature failing of XBM reading)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
+var_dump($im);
+?>
+===DONE===
+--EXPECTF--
+resource(%d) of type (gd)
+===DONE===
-<?php\r
-\r
-function get_gd_version()\r
-{\r
- return GD_VERSION;\r
-}\r
-\r
-function get_php_info()\r
-{\r
- ob_start();\r
- phpinfo();\r
- $info = ob_get_contents();\r
- ob_end_clean();\r
-\r
- return $info;\r
-}\r
-\r
-function get_freetype_version()\r
-{\r
- $version = 0;\r
- \r
- if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {\r
- $version = $match[1];\r
- }\r
- \r
- return $version;\r
-}\r
-\r
-function get_libjpeg_version()\r
-{\r
- $version = 0;\r
- \r
- if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {\r
- $version = $match[1];\r
- }\r
- \r
- return $version;\r
-}\r
-\r
-function get_libpng_version()\r
-{\r
- $version = 0;\r
- \r
- if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {\r
- $version = $match[1];\r
- }\r
- \r
- return $version;\r
-}\r
-\r
-function get_libxpm_version()\r
-{\r
- $version = 0;\r
- \r
- if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {\r
- $version = $match[1];\r
- }\r
- \r
- return $version;\r
-}\r
-\r
-/**\r
- * Tests that an in-memory image equals a PNG file.\r
- *\r
- * It checks for equal image sizes, and whether any pixels are different.\r
- * The textual result is printed, so the EXPECT section should contain the line\r
- * "The images are equal."\r
- *\r
- * If the PNG file does not exists, or the images are not equal, a diagnostic\r
- * message is printed, and the actual file is stored right beside the temporary\r
- * .php test file with the extension .out.png, to be able to manually inspect\r
- * the result.\r
- *\r
- * @param string $filename\r
- * @param resource $actual\r
- * @return void\r
- */\r
-function test_image_equals_file($filename, $actual)\r
-{\r
- if (!file_exists($filename)) {\r
- echo "The expected image does not exist.\n";\r
- save_actual_image($actual);\r
- return;\r
- }\r
- $actual = test_to_truecolor($actual);\r
- $expected = imagecreatefrompng($filename);\r
- $expected = test_to_truecolor($expected);\r
- $exp_x = imagesx($expected);\r
- $exp_y = imagesy($expected);\r
- $act_x = imagesx($actual);\r
- $act_y = imagesy($actual);\r
- if ($exp_x != $act_x || $exp_y != $act_y) {\r
- echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";\r
- save_actual_image($actual);\r
- return;\r
- }\r
- $pixels_changed = 0;\r
- for ($y = 0; $y < $exp_y; $y++) {\r
- for ($x = 0; $x < $exp_x; $x ++) {\r
- $exp_c = imagecolorat($expected, $x, $y);\r
- $act_c = imagecolorat($actual, $x, $y);\r
- if ($exp_c != $act_c) {\r
- $pixels_changed++;\r
- }\r
- }\r
- }\r
- if (!$pixels_changed) {\r
- echo "The images are equal.\n";\r
- } else {\r
- echo "The images differ in {$pixels_changed} pixels.\n";\r
- save_actual_image($actual);\r
- }\r
-}\r
-\r
-/**\r
- * Returns the truecolor version of an image.\r
- *\r
- * @param resource $image\r
- * @return resource\r
- */\r
-function test_to_truecolor($image)\r
-{\r
- if (imageistruecolor($image)) {\r
- return $image;\r
- } else {\r
- $width = imagesx($image);\r
- $height = imagesy($image);\r
- $result = imagecreatetruecolor($width, $height);\r
- imagecopy($result, $image, 0,0, 0,0, $width, $height);\r
- return $result;\r
- }\r
-}\r
-\r
-/**\r
- * Saves an actual image to disk.\r
- *\r
- * The image is saved right beside the temporary .php test file with the\r
- * extension .out.png.\r
- *\r
- * @param resource $image\r
- * @return void\r
- */\r
-function save_actual_image($image)\r
-{\r
- $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);\r
- $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";\r
- imagepng($image, $filename);\r
-}\r
+<?php
+
+function get_gd_version()
+{
+ return GD_VERSION;
+}
+
+function get_php_info()
+{
+ ob_start();
+ phpinfo();
+ $info = ob_get_contents();
+ ob_end_clean();
+
+ return $info;
+}
+
+function get_freetype_version()
+{
+ $version = 0;
+
+ if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
+
+ return $version;
+}
+
+function get_libjpeg_version()
+{
+ $version = 0;
+
+ if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
+
+ return $version;
+}
+
+function get_libpng_version()
+{
+ $version = 0;
+
+ if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
+
+ return $version;
+}
+
+function get_libxpm_version()
+{
+ $version = 0;
+
+ if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
+
+ return $version;
+}
+
+/**
+ * Tests that an in-memory image equals a PNG file.
+ *
+ * It checks for equal image sizes, and whether any pixels are different.
+ * The textual result is printed, so the EXPECT section should contain the line
+ * "The images are equal."
+ *
+ * If the PNG file does not exists, or the images are not equal, a diagnostic
+ * message is printed, and the actual file is stored right beside the temporary
+ * .php test file with the extension .out.png, to be able to manually inspect
+ * the result.
+ *
+ * @param string $filename
+ * @param resource $actual
+ * @return void
+ */
+function test_image_equals_file($filename, $actual)
+{
+ if (!file_exists($filename)) {
+ echo "The expected image does not exist.\n";
+ save_actual_image($actual);
+ return;
+ }
+ $actual = test_to_truecolor($actual);
+ $expected = imagecreatefrompng($filename);
+ $expected = test_to_truecolor($expected);
+ $exp_x = imagesx($expected);
+ $exp_y = imagesy($expected);
+ $act_x = imagesx($actual);
+ $act_y = imagesy($actual);
+ if ($exp_x != $act_x || $exp_y != $act_y) {
+ echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
+ save_actual_image($actual);
+ return;
+ }
+ $pixels_changed = 0;
+ for ($y = 0; $y < $exp_y; $y++) {
+ for ($x = 0; $x < $exp_x; $x ++) {
+ $exp_c = imagecolorat($expected, $x, $y);
+ $act_c = imagecolorat($actual, $x, $y);
+ if ($exp_c != $act_c) {
+ $pixels_changed++;
+ }
+ }
+ }
+ if (!$pixels_changed) {
+ echo "The images are equal.\n";
+ } else {
+ echo "The images differ in {$pixels_changed} pixels.\n";
+ save_actual_image($actual);
+ }
+}
+
+/**
+ * Returns the truecolor version of an image.
+ *
+ * @param resource $image
+ * @return resource
+ */
+function test_to_truecolor($image)
+{
+ if (imageistruecolor($image)) {
+ return $image;
+ } else {
+ $width = imagesx($image);
+ $height = imagesy($image);
+ $result = imagecreatetruecolor($width, $height);
+ imagecopy($result, $image, 0,0, 0,0, $width, $height);
+ return $result;
+ }
+}
+
+/**
+ * Saves an actual image to disk.
+ *
+ * The image is saved right beside the temporary .php test file with the
+ * extension .out.png.
+ *
+ * @param resource $image
+ * @return void
+ */
+function save_actual_image($image)
+{
+ $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
+ $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
+ imagepng($image, $filename);
+}
---TEST-- \r
-Testing imagecropauto() \r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); \r
-if (GD_BUNDLED) die('skip requires external libgd');\r
-?> \r
---FILE--\r
-<?php\r
-\r
-echo "TC IMG_CROP_DEFAULT\n";\r
-$im = imagecreatetruecolor(99, 99); \r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "Palette IMG_CROP_DEFAULT\n";\r
-$im = imagecreate(99, 99); \r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "TC IMG_CROP_SIDES\n";\r
-$im = imagecreatetruecolor(99, 99); \r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "Palette IMG_CROP_SIDES\n";\r
-$im = imagecreate(99, 99); \r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "TC IMG_CROP_BLACK\n";\r
-$im = imagecreatetruecolor(50, 50);\r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "Palette IMG_CROP_BLACK\n";\r
-$im = imagecreate(50, 50);\r
-$bgd = imagecolorallocate($im, 0, 0, 0);\r
-$b = imagecolorallocate($im, 0, 0, 255);\r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "IMG_CROP_THRESHOLD\n";\r
-$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");\r
-$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);\r
-imagepng($im_crop, __DIR__ . "/crop_threshold.png");\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-@unlink(__DIR__ . "/crop_threshold.png");\r
-?> \r
---EXPECT-- \r
-TC IMG_CROP_DEFAULT\r
-int(99)\r
-int(99)\r
-Palette IMG_CROP_DEFAULT\r
-int(99)\r
-int(99)\r
-TC IMG_CROP_SIDES\r
-int(11)\r
-int(11)\r
-Palette IMG_CROP_SIDES\r
-int(11)\r
-int(11)\r
-TC IMG_CROP_BLACK\r
-int(11)\r
-int(11)\r
-Palette IMG_CROP_BLACK\r
-int(11)\r
-int(11)\r
-IMG_CROP_THRESHOLD\r
-int(240)\r
-int(134)\r
+--TEST--
+Testing imagecropauto()
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
+if (GD_BUNDLED) die('skip requires external libgd');
+?>
+--FILE--
+<?php
+
+echo "TC IMG_CROP_DEFAULT\n";
+$im = imagecreatetruecolor(99, 99);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "Palette IMG_CROP_DEFAULT\n";
+$im = imagecreate(99, 99);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "TC IMG_CROP_SIDES\n";
+$im = imagecreatetruecolor(99, 99);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_SIDES);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "Palette IMG_CROP_SIDES\n";
+$im = imagecreate(99, 99);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_SIDES);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "TC IMG_CROP_BLACK\n";
+$im = imagecreatetruecolor(50, 50);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_BLACK);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "Palette IMG_CROP_BLACK\n";
+$im = imagecreate(50, 50);
+$bgd = imagecolorallocate($im, 0, 0, 0);
+$b = imagecolorallocate($im, 0, 0, 255);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_BLACK);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "IMG_CROP_THRESHOLD\n";
+$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
+$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
+imagepng($im_crop, __DIR__ . "/crop_threshold.png");
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+@unlink(__DIR__ . "/crop_threshold.png");
+?>
+--EXPECT--
+TC IMG_CROP_DEFAULT
+int(99)
+int(99)
+Palette IMG_CROP_DEFAULT
+int(99)
+int(99)
+TC IMG_CROP_SIDES
+int(11)
+int(11)
+Palette IMG_CROP_SIDES
+int(11)
+int(11)
+TC IMG_CROP_BLACK
+int(11)
+int(11)
+Palette IMG_CROP_BLACK
+int(11)
+int(11)
+IMG_CROP_THRESHOLD
+int(240)
+int(134)
---TEST-- \r
-Testing imagecropauto() \r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); \r
-if (!GD_BUNDLED) die('skip requires bundled libgd');\r
-?> \r
---FILE--\r
-<?php\r
-\r
-echo "TC IMG_CROP_DEFAULT\n";\r
-$im = imagecreatetruecolor(99, 99); \r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "Palette IMG_CROP_DEFAULT\n";\r
-$im = imagecreate(99, 99); \r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "TC IMG_CROP_SIDES\n";\r
-$im = imagecreatetruecolor(99, 99); \r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "Palette IMG_CROP_SIDES\n";\r
-$im = imagecreate(99, 99); \r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "TC IMG_CROP_BLACK\n";\r
-$im = imagecreatetruecolor(50, 50);\r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "Palette IMG_CROP_BLACK\n";\r
-$im = imagecreate(50, 50);\r
-$bgd = imagecolorallocate($im, 0, 0, 0);\r
-$b = imagecolorallocate($im, 0, 0, 255);\r
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);\r
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-echo "IMG_CROP_THRESHOLD\n";\r
-$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");\r
-$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);\r
-imagepng($im_crop, __DIR__ . "/crop_threshold.png");\r
-var_dump(imagesx($im_crop));\r
-var_dump(imagesy($im_crop));\r
-\r
-@unlink(__DIR__ . "/crop_threshold.png");\r
-?> \r
---EXPECT-- \r
-TC IMG_CROP_DEFAULT\r
-int(11)\r
-int(11)\r
-Palette IMG_CROP_DEFAULT\r
-int(11)\r
-int(11)\r
-TC IMG_CROP_SIDES\r
-int(11)\r
-int(11)\r
-Palette IMG_CROP_SIDES\r
-int(11)\r
-int(11)\r
-TC IMG_CROP_BLACK\r
-int(11)\r
-int(11)\r
-Palette IMG_CROP_BLACK\r
-int(11)\r
-int(11)\r
-IMG_CROP_THRESHOLD\r
-int(240)\r
-int(134)\r
+--TEST--
+Testing imagecropauto()
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
+if (!GD_BUNDLED) die('skip requires bundled libgd');
+?>
+--FILE--
+<?php
+
+echo "TC IMG_CROP_DEFAULT\n";
+$im = imagecreatetruecolor(99, 99);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "Palette IMG_CROP_DEFAULT\n";
+$im = imagecreate(99, 99);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "TC IMG_CROP_SIDES\n";
+$im = imagecreatetruecolor(99, 99);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_SIDES);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "Palette IMG_CROP_SIDES\n";
+$im = imagecreate(99, 99);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_SIDES);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "TC IMG_CROP_BLACK\n";
+$im = imagecreatetruecolor(50, 50);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_BLACK);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "Palette IMG_CROP_BLACK\n";
+$im = imagecreate(50, 50);
+$bgd = imagecolorallocate($im, 0, 0, 0);
+$b = imagecolorallocate($im, 0, 0, 255);
+imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
+$im_crop = imagecropauto($im, IMG_CROP_BLACK);
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+echo "IMG_CROP_THRESHOLD\n";
+$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
+$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
+imagepng($im_crop, __DIR__ . "/crop_threshold.png");
+var_dump(imagesx($im_crop));
+var_dump(imagesy($im_crop));
+
+@unlink(__DIR__ . "/crop_threshold.png");
+?>
+--EXPECT--
+TC IMG_CROP_DEFAULT
+int(11)
+int(11)
+Palette IMG_CROP_DEFAULT
+int(11)
+int(11)
+TC IMG_CROP_SIDES
+int(11)
+int(11)
+Palette IMG_CROP_SIDES
+int(11)
+int(11)
+TC IMG_CROP_BLACK
+int(11)
+int(11)
+Palette IMG_CROP_BLACK
+int(11)
+int(11)
+IMG_CROP_THRESHOLD
+int(240)
+int(134)
---TEST--\r
-Testing wrong param passing imageellipse() of GD library\r
---CREDITS--\r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>\r
-#testfest PHPSP on 2009-06-20\r
---SKIPIF--\r
-<?php \r
-if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );\r
-?>\r
---FILE--\r
-<?php\r
-\r
-// Create a image\r
-$image = imagecreatetruecolor( 400, 300 );\r
-\r
-// try to draw a white ellipse\r
-imageellipse( $image, 200, 150, 300, 200 );\r
-\r
-?>\r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor( 400, 300 );
+
+// try to draw a white ellipse
+imageellipse( $image, 200, 150, 300, 200 );
+
+?>
+--EXPECTF--
Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d
---TEST-- \r
-Testing wrong param passing imagefilltoborder() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded("gd")) die("skip GD not present; skipping test"); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );\r
-\r
-// Draw an ellipse to fill with a black border\r
-imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );\r
-\r
-// Try to fill border\r
-imagefilltoborder( $image, 50, 50 );\r
-\r
-?> \r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 50 );
+
+?>
+--EXPECTF--
Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d
---TEST-- \r
-Testing imageflip() of GD library \r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-\r
-$im = imagecreatetruecolor( 99, 99 ); \r
-\r
-imagesetpixel($im, 0, 0, 0xFF);\r
-imagesetpixel($im, 0, 98, 0x00FF00);\r
-imagesetpixel($im, 98, 0, 0xFF0000);\r
-imagesetpixel($im, 98, 98, 0x0000FF);\r
-\r
-imageflip($im, IMG_FLIP_HORIZONTAL);\r
-imageflip($im, IMG_FLIP_VERTICAL);\r
-imageflip($im, IMG_FLIP_BOTH);\r
-\r
-var_dump(dechex(imagecolorat($im, 0, 0)));\r
-var_dump(dechex(imagecolorat($im, 0, 98)));\r
-var_dump(dechex(imagecolorat($im, 98, 0)));\r
-var_dump(dechex(imagecolorat($im, 98, 98)));\r
-?> \r
---EXPECT-- \r
-string(2) "ff"\r
-string(4) "ff00"\r
-string(6) "ff0000"\r
+--TEST--
+Testing imageflip() of GD library
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+
+$im = imagecreatetruecolor( 99, 99 );
+
+imagesetpixel($im, 0, 0, 0xFF);
+imagesetpixel($im, 0, 98, 0x00FF00);
+imagesetpixel($im, 98, 0, 0xFF0000);
+imagesetpixel($im, 98, 98, 0x0000FF);
+
+imageflip($im, IMG_FLIP_HORIZONTAL);
+imageflip($im, IMG_FLIP_VERTICAL);
+imageflip($im, IMG_FLIP_BOTH);
+
+var_dump(dechex(imagecolorat($im, 0, 0)));
+var_dump(dechex(imagecolorat($im, 0, 98)));
+var_dump(dechex(imagecolorat($im, 98, 0)));
+var_dump(dechex(imagecolorat($im, 98, 98)));
+?>
+--EXPECT--
+string(2) "ff"
+string(4) "ff00"
+string(6) "ff0000"
string(2) "ff"
\ No newline at end of file
---TEST-- \r
-Testing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );\r
-\r
-include_once __DIR__ . '/func.inc';\r
-test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);\r
-?> \r
---EXPECT-- \r
-The images are equal.\r
+--TEST--
+Testing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+
+include_once __DIR__ . '/func.inc';
+test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
+?>
+--EXPECT--
+The images are equal.
---TEST-- \r
-Testing wrong param passing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );\r
-?> \r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d
---TEST-- \r
-Testing wrong param passing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a resource \r
-$image = tmpfile(); \r
-\r
-// Draw a rectangle\r
-imagerectangle( $image, 0, 0, 50, 50, 2 );\r
-?> \r
---EXPECTF-- \r
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a resource
+$image = tmpfile();
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, 2 );
+?>
+--EXPECTF--
Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d
\ No newline at end of file
---TEST-- \r
-Testing wrong param passing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );\r
-?> \r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 2 to be integer, %s given in %s on line %d
---TEST-- \r
-Testing wrong param passing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );\r
-?> \r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 3 to be integer, %s given in %s on line %d
---TEST-- \r
-Testing wrong param passing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );\r
-?> \r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 4 to be integer, %s given in %s on line %d
---TEST-- \r
-Testing wrong param passing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );\r
-?> \r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 5 to be integer, %s given in %s on line %d
---TEST-- \r
-Testing wrong param passing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );\r
-?> \r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
+?>
+--EXPECTF--
Warning: imagerectangle() expects parameter 6 to be integer, %s given in %s on line %d
---TEST-- \r
-Testing wrong param passing imagerectangle() of GD library \r
---CREDITS-- \r
-Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
-#testfest PHPSP on 2009-06-30\r
---SKIPIF-- \r
-<?php \r
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
-?> \r
---FILE--\r
-<?php\r
-// Create a image \r
-$image = imagecreatetruecolor( 100, 100 ); \r
-\r
-// Draw a rectangle\r
-imagerectangle( $image, 0, 0, 50, 50 );\r
-?> \r
---EXPECTF--\r
+--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50 );
+?>
+--EXPECTF--
Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d
---TEST--\r
-test_image_equals_file(): comparing palette images\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-?>\r
---FILE--\r
-<?php\r
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';\r
-\r
-$im = imagecreate(10, 10);\r
-imagecolorallocate($im, 255, 255, 255);\r
-$red = imagecolorallocate($im, 255, 0, 0);\r
-imagefilledrectangle($im, 3,3, 7,7, $red);\r
-\r
-$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';\r
-imagepng($im, $filename);\r
-\r
-$im = imagecreate(10, 10);\r
-imagecolorallocate($im, 255, 255, 255);\r
-$blue = imagecolorallocate($im, 0, 0, 255);\r
-imagefilledrectangle($im, 3,3, 7,7, $blue);\r
-\r
-test_image_equals_file($filename, $im);\r
-\r
-$im = imagecreate(10, 10);\r
-imagecolorallocate($im, 255, 255, 255);\r
-imagecolorallocate($im, 0, 0, 0);\r
-$red = imagecolorallocate($im, 255, 0, 0);\r
-imagefilledrectangle($im, 3,3, 7,7, $red);\r
-\r
-test_image_equals_file($filename, $im);\r
-?>\r
-===DONE===\r
---EXPECT--\r
-The images differ in 25 pixels.\r
-The images are equal.\r
-===DONE===\r
---CLEAN--\r
-<?php\r
-unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');\r
-?>\r
+--TEST--
+test_image_equals_file(): comparing palette images
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
+
+$im = imagecreate(10, 10);
+imagecolorallocate($im, 255, 255, 255);
+$red = imagecolorallocate($im, 255, 0, 0);
+imagefilledrectangle($im, 3,3, 7,7, $red);
+
+$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
+imagepng($im, $filename);
+
+$im = imagecreate(10, 10);
+imagecolorallocate($im, 255, 255, 255);
+$blue = imagecolorallocate($im, 0, 0, 255);
+imagefilledrectangle($im, 3,3, 7,7, $blue);
+
+test_image_equals_file($filename, $im);
+
+$im = imagecreate(10, 10);
+imagecolorallocate($im, 255, 255, 255);
+imagecolorallocate($im, 0, 0, 0);
+$red = imagecolorallocate($im, 255, 0, 0);
+imagefilledrectangle($im, 3,3, 7,7, $red);
+
+test_image_equals_file($filename, $im);
+?>
+===DONE===
+--EXPECT--
+The images differ in 25 pixels.
+The images are equal.
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
+?>
---TEST--\r
-imagewebp() and imagecreatefromwebp() - basic test\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('gd')) die('skip gd extension not available');\r
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {\r
- die("skip test requires GD 2.2.0 or higher");\r
-}\r
-if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))\r
- die('skip WebP support not available');\r
-?>\r
---FILE--\r
-<?php\r
-require_once __DIR__ . '/similarity.inc';\r
-\r
-$filename = __DIR__ . '/webp_basic.webp';\r
-\r
-$im1 = imagecreatetruecolor(75, 75);\r
-$white = imagecolorallocate($im1, 255, 255, 255);\r
-$red = imagecolorallocate($im1, 255, 0, 0);\r
-$green = imagecolorallocate($im1, 0, 255, 0);\r
-$blue = imagecolorallocate($im1, 0, 0, 255);\r
-imagefilledrectangle($im1, 0, 0, 74, 74, $white);\r
-imageline($im1, 3, 3, 71, 71, $red);\r
-imageellipse($im1, 18, 54, 36, 36, $green);\r
-imagerectangle($im1, 41, 3, 71, 33, $blue);\r
-imagewebp($im1, $filename);\r
-\r
-$im2 = imagecreatefromwebp($filename);\r
-imagewebp($im2, $filename);\r
-var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);\r
-?>\r
---CLEAN--\r
-<?php\r
-@unlink(__DIR__ . '/webp_basic.webp');\r
-?>\r
---EXPECT--\r
-bool(true)\r
+--TEST--
+imagewebp() and imagecreatefromwebp() - basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
+ die("skip test requires GD 2.2.0 or higher");
+}
+if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
+ die('skip WebP support not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . '/similarity.inc';
+
+$filename = __DIR__ . '/webp_basic.webp';
+
+$im1 = imagecreatetruecolor(75, 75);
+$white = imagecolorallocate($im1, 255, 255, 255);
+$red = imagecolorallocate($im1, 255, 0, 0);
+$green = imagecolorallocate($im1, 0, 255, 0);
+$blue = imagecolorallocate($im1, 0, 0, 255);
+imagefilledrectangle($im1, 0, 0, 74, 74, $white);
+imageline($im1, 3, 3, 71, 71, $red);
+imageellipse($im1, 18, 54, 36, 36, $green);
+imagerectangle($im1, 41, 3, 71, 33, $blue);
+imagewebp($im1, $filename);
+
+$im2 = imagecreatefromwebp($filename);
+imagewebp($im2, $filename);
+var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . '/webp_basic.webp');
+?>
+--EXPECT--
+bool(true)
int(0)
int(0)
int(1)
-==DONE==\r
+==DONE==
--EXPECT--
bool(true)
bool(true)
-==DONE==\r
+==DONE==
int(6)
bool(true)
int(5)
-==DONE==\r
+==DONE==
---TEST--\r
-IntlDateFormatter::formatObject(): IntlCalendar tests\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>\r
-<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>\r
---FILE--\r
-<?php\r
-ini_set("intl.error_level", E_WARNING);\r
-ini_set("intl.default_locale", "pt_PT");\r
-ini_set("date.timezone", "Europe/Lisbon");\r
-\r
-$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon\r
-echo IntlDateFormatter::formatObject($cal), "\n";\r
-echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";\r
-echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";\r
-echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";\r
-echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";\r
-\r
-$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');\r
-echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";\r
-\r
-$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');\r
-$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);\r
-echo IntlDateFormatter::formatObject($cal), "\n";\r
-echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";\r
-\r
-?>\r
-==DONE==\r
-\r
---EXPECTF--\r
-01/01/2012 00:00:00\r
-Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental\r
-Jan 1, 2012 12:00:00 AM\r
-1/1/12 12:00:00 AM Western European %STime\r
-Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)\r
-Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00\r
-06/02/1433 00:00:00\r
-Sunday, Safar 6, 1433 12:00:00 AM Western European %STime\r
-==DONE==\r
-\r
+--TEST--
+IntlDateFormatter::formatObject(): IntlCalendar tests
+--SKIPIF--
+<?php
+if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
+<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", "Europe/Lisbon");
+
+$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
+echo IntlDateFormatter::formatObject($cal), "\n";
+echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
+echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
+echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
+echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
+
+$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
+echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
+
+$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
+$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
+echo IntlDateFormatter::formatObject($cal), "\n";
+echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
+
+?>
+==DONE==
+
+--EXPECTF--
+01/01/2012 00:00:00
+Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
+Jan 1, 2012 12:00:00 AM
+1/1/12 12:00:00 AM Western European %STime
+Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
+Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
+06/02/1433 00:00:00
+Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
+==DONE==
+
---TEST--\r
-IntlDateFormatter::formatObject(): IntlCalendar tests\r
---SKIPIF--\r
-<?php\r
+--TEST--
+IntlDateFormatter::formatObject(): IntlCalendar tests
+--SKIPIF--
+<?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
---FILE--\r
+--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
?>
==DONE==
-\r
---EXPECTF--\r
+
+--EXPECTF--
01/01/2012, 00:00:00
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
Jan 1, 2012, 12:00:00 AM
---TEST--\r
-IntlDateFormatter::formatObject(): DateTime tests\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('intl')) die('skip intl extension not enabled') ?>\r
-<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>\r
---FILE--\r
-<?php\r
-ini_set("intl.error_level", E_WARNING);\r
-ini_set("intl.default_locale", "pt_PT");\r
-ini_set("date.timezone", "Europe/Lisbon");\r
-\r
-$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon\r
-echo IntlDateFormatter::formatObject($dt), "\n";\r
-echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";\r
-echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";\r
-echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";\r
-echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";\r
-\r
-$dt = new DateTime('2012-01-01 05:00:00+03:00');\r
-echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";\r
-\r
-?>\r
-==DONE==\r
-\r
---EXPECTF--\r
-01/01/2012 00:00:00\r
-Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental\r
-Jan 1, 2012 12:00:00 AM\r
-1/1/12 12:00:00 AM Western European %STime\r
-Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)\r
-Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00\r
-==DONE==\r
-\r
+--TEST--
+IntlDateFormatter::formatObject(): DateTime tests
+--SKIPIF--
+<?php
+if (!extension_loaded('intl')) die('skip intl extension not enabled') ?>
+<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", "Europe/Lisbon");
+
+$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
+echo IntlDateFormatter::formatObject($dt), "\n";
+echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
+echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
+echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
+echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
+
+$dt = new DateTime('2012-01-01 05:00:00+03:00');
+echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
+
+?>
+==DONE==
+
+--EXPECTF--
+01/01/2012 00:00:00
+Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
+Jan 1, 2012 12:00:00 AM
+1/1/12 12:00:00 AM Western European %STime
+Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
+Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
+==DONE==
+
---TEST--\r
-IntlDateFormatter::formatObject(): DateTime tests\r
---SKIPIF--\r
-<?php\r
+--TEST--
+IntlDateFormatter::formatObject(): DateTime tests
+--SKIPIF--
+<?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
---FILE--\r
+--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
?>
==DONE==
-\r
---EXPECTF--\r
+
+--EXPECTF--
01/01/2012, 00:00:00
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
Jan 1, 2012, 12:00:00 AM
---TEST--\r
-IntlDateFormatter::formatObject(): error conditions\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('intl'))\r
- die('skip intl extension not enabled');\r
---FILE--\r
+--TEST--
+IntlDateFormatter::formatObject(): error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
?>
==DONE==
-\r
---EXPECTF--\r
+
+--EXPECTF--
Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
bool(false)
==DONE==
-\r
+
-<?php\r
-// THIS SCRIPT WILL REBUILD ResourceBundle bundles from source files\r
-\r
-// DEFINE YOUR ICU TOOLS PATH HERE\r
-define("ICU_DIR", "C:/PROJECTS/ICU40/BIN/");\r
-\r
-$here = dirname(__FILE__);\r
-\r
-$dir = new GlobIterator("$here/_files/*.txt", FilesystemIterator::KEY_AS_FILENAME);\r
-\r
-foreach($dir as $file) {\r
- passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle ".$file->getFileName());\r
-}\r
-\r
-$dir = new GlobIterator("$here/_files/resourcebundle/*.res", FilesystemIterator::KEY_AS_FILENAME);\r
-foreach($dir as $file) {\r
- if($file->getFileName() == "res_index.res") continue;\r
- $list[] = str_replace(".res", "", $file->getFileName());\r
-}\r
-\r
-$filelist = join(" {\"\"}\n", $list);\r
-$res_index = <<<END\r
-res_index:table(nofallback) {\r
- InstalledLocales {\r
-$filelist {""}\r
- }\r
-}\r
-END;\r
-file_put_contents("$here/_files/res_index.txt", $res_index);\r
-\r
-passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle res_index.txt");\r
-\r
+<?php
+// THIS SCRIPT WILL REBUILD ResourceBundle bundles from source files
+
+// DEFINE YOUR ICU TOOLS PATH HERE
+define("ICU_DIR", "C:/PROJECTS/ICU40/BIN/");
+
+$here = dirname(__FILE__);
+
+$dir = new GlobIterator("$here/_files/*.txt", FilesystemIterator::KEY_AS_FILENAME);
+
+foreach($dir as $file) {
+ passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle ".$file->getFileName());
+}
+
+$dir = new GlobIterator("$here/_files/resourcebundle/*.res", FilesystemIterator::KEY_AS_FILENAME);
+foreach($dir as $file) {
+ if($file->getFileName() == "res_index.res") continue;
+ $list[] = str_replace(".res", "", $file->getFileName());
+}
+
+$filelist = join(" {\"\"}\n", $list);
+$res_index = <<<END
+res_index:table(nofallback) {
+ InstalledLocales {
+$filelist {""}
+ }
+}
+END;
+file_put_contents("$here/_files/res_index.txt", $res_index);
+
+passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle res_index.txt");
+
// passthru(ICU_DIR."icupkg -tl -a $here/rb.txt -s $here/_files -d $here/_files new $here/_files/resourcebundle.dat");
\ No newline at end of file
[rawOffset] => %i
[currentOffset] => %i
)
-==DONE==\r
+==DONE==
bool(true)
string(0) ""
bool(false)
-==DONE==\r
+==DONE==
string(3) "GMT"
string(3) "GMT"
string(13) "Portugal Time"
-==DONE==\r
+==DONE==
---TEST--\r
-Bug #52981 (Unicode properties are outdated (from Unicode 3.2))\r
---SKIPIF--\r
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>\r
---FILE--\r
-<?php\r
-function test($str)\r
-{\r
- $upper = mb_strtoupper($str, 'UTF-8');\r
- $len = strlen($upper);\r
- for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';\r
- echo "\n";\r
-}\r
-\r
-// OK\r
-test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)\r
-// not OK\r
-test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005)\r
-test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009)\r
---EXPECTF--\r
-f0 90 90 90 \r
-e2 b0 80 \r
-d4 a4 \r
+--TEST--
+Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+function test($str)
+{
+ $upper = mb_strtoupper($str, 'UTF-8');
+ $len = strlen($upper);
+ for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
+ echo "\n";
+}
+
+// OK
+test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)
+// not OK
+test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005)
+test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009)
+--EXPECTF--
+f0 90 90 90
+e2 b0 80
+d4 a4
---TEST--\r
-Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter)\r
---SKIPIF--\r
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>\r
---FILE--\r
-<?php\r
-var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?'\r
-var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?'\r
-?>\r
---EXPECT--\r
-string(12) "Windows-1251"\r
-string(12) "Windows-1251"\r
-\r
+--TEST--
+Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter)
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?'
+var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?'
+?>
+--EXPECT--
+string(12) "Windows-1251"
+string(12) "Windows-1251"
+
---TEST--\r
-mcrypt_create_iv https://bugs.php.net/bug.php?id=55169\r
---CREDIT--\r
-Ryan Biesemeyer <ryan@yaauie.com>\r
---SKIPIF--\r
-<?php if (!extension_loaded("mcrypt")) print "skip"; ?>\r
---FILE--\r
-<?php\r
-for( $i=1; $i<=64; $i = $i*2 ){\r
- echo 'Input: '. $i . PHP_EOL;\r
- $random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );\r
- echo ' Length: ' . strlen( $random ) . PHP_EOL;\r
- echo ' Hex: '. bin2hex( $random ) . PHP_EOL;\r
- echo PHP_EOL;\r
-}\r
-?>\r
---EXPECTF--\r
-Input: 1\r
-\r
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4\r
- Length: 1\r
- Hex: %x\r
-\r
-Input: 2\r
-\r
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4\r
- Length: 2\r
- Hex: %x\r
-\r
-Input: 4\r
-\r
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4\r
- Length: 4\r
- Hex: %x\r
-\r
-Input: 8\r
-\r
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4\r
- Length: 8\r
- Hex: %x\r
-\r
-Input: 16\r
-\r
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4\r
- Length: 16\r
- Hex: %x\r
-\r
-Input: 32\r
-\r
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4\r
- Length: 32\r
- Hex: %x\r
-\r
-Input: 64\r
-\r
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4\r
- Length: 64\r
- Hex: %x\r
+--TEST--
+mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
+--CREDIT--
+Ryan Biesemeyer <ryan@yaauie.com>
+--SKIPIF--
+<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
+--FILE--
+<?php
+for( $i=1; $i<=64; $i = $i*2 ){
+ echo 'Input: '. $i . PHP_EOL;
+ $random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
+ echo ' Length: ' . strlen( $random ) . PHP_EOL;
+ echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
+ echo PHP_EOL;
+}
+?>
+--EXPECTF--
+Input: 1
+
+Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
+ Length: 1
+ Hex: %x
+
+Input: 2
+
+Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
+ Length: 2
+ Hex: %x
+
+Input: 4
+
+Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
+ Length: 4
+ Hex: %x
+
+Input: 8
+
+Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
+ Length: 8
+ Hex: %x
+
+Input: 16
+
+Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
+ Length: 16
+ Hex: %x
+
+Input: 32
+
+Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
+ Length: 32
+ Hex: %x
+
+Input: 64
+
+Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
+ Length: 64
+ Hex: %x
---TEST--\r
-Bug #53503 (mysqli::query returns false after successful LOAD DATA query)\r
---SKIPIF--\r
-<?php\r
-require_once('skipif.inc');\r
-require_once('skipifconnectfailure.inc');\r
-\r
-if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))\r
- die("skip Cannot connect to MySQL");\r
-\r
-include_once("local_infile_tools.inc");\r
-if ($msg = check_local_infile_support($link, $engine))\r
- die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));\r
-\r
-mysqli_close($link);\r
-\r
-?>\r
---FILE--\r
-<?php\r
- require_once("connect.inc");\r
-\r
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {\r
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());\r
- }\r
-\r
- if (!$link->query("DROP TABLE IF EXISTS test")) {\r
- printf("[002] [%d] %s\n", $link->errno, $link->error);\r
- }\r
-\r
- if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {\r
- printf("[003] [%d] %s\n", $link->errno, $link->error);\r
- }\r
-\r
- if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))\r
- printf("[004] Failed to create CVS file\n");\r
-\r
- if (!$link->query("SELECT 1 FROM DUAL"))\r
- printf("[005] [%d] %s\n", $link->errno, $link->error);\r
-\r
- if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {\r
- printf("[006] [%d] %s\n", $link->errno, $link->error);\r
- echo "bug";\r
- } else {\r
- echo "done";\r
- }\r
- $link->close();\r
-?>\r
---CLEAN--\r
-<?php\r
-require_once('connect.inc');\r
-\r
-if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {\r
- printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",\r
- $host, $user, $db, $port, $socket);\r
-}\r
-\r
-if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {\r
- printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));\r
-}\r
-\r
-$link->close();\r
-\r
-unlink('bug53503.data');\r
-?>\r
---EXPECT--\r
+--TEST--
+Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ die("skip Cannot connect to MySQL");
+
+include_once("local_infile_tools.inc");
+if ($msg = check_local_infile_support($link, $engine))
+ die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+
+mysqli_close($link);
+
+?>
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
+ printf("[004] Failed to create CVS file\n");
+
+ if (!$link->query("SELECT 1 FROM DUAL"))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+
+ if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ echo "bug";
+ } else {
+ echo "done";
+ }
+ $link->close();
+?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+$link->close();
+
+unlink('bug53503.data');
+?>
+--EXPECT--
done
\ No newline at end of file
---TEST--\r
-Bug #55653 PS crash with libmysql when binding same variable as param and out\r
---SKIPIF--\r
-<?php\r
-require_once('skipif.inc');\r
-require_once('skipifconnectfailure.inc');\r
-?>\r
---FILE--\r
-<?php\r
- require_once("connect.inc");\r
-\r
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {\r
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());\r
- }\r
-\r
- $in_and_out = "a";\r
-\r
- if (!($stmt = $link->stmt_init()))\r
- printf("[002] [%d] %s\n", $link->errno, $link->error);\r
-\r
- if (!($stmt->prepare("SELECT ?")) ||\r
- !($stmt->bind_param("s", $in_and_out)) ||\r
- !($stmt->execute()) ||\r
- !($stmt->bind_result($in_and_out)))\r
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);\r
-\r
- if (!$stmt->fetch())\r
- printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);\r
-\r
- if ("a" !== $in_and_out)\r
- printf("[005] Wrong result: '%s'\n", $in_and_out);\r
-\r
- echo "done!";\r
-?>\r
---EXPECT--\r
+--TEST--
+Bug #55653 PS crash with libmysql when binding same variable as param and out
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ $in_and_out = "a";
+
+ if (!($stmt = $link->stmt_init()))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+
+ if (!($stmt->prepare("SELECT ?")) ||
+ !($stmt->bind_param("s", $in_and_out)) ||
+ !($stmt->execute()) ||
+ !($stmt->bind_result($in_and_out)))
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ if (!$stmt->fetch())
+ printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ if ("a" !== $in_and_out)
+ printf("[005] Wrong result: '%s'\n", $in_and_out);
+
+ echo "done!";
+?>
+--EXPECT--
done!
\ No newline at end of file
---TEST--\r
-Bug #55859 mysqli->stat property access gives error\r
---SKIPIF--\r
-<?php\r
-require_once('skipif.inc');\r
-require_once('skipifconnectfailure.inc');\r
-?>\r
---FILE--\r
-<?php\r
- require_once("connect.inc");\r
-\r
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {\r
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());\r
- }\r
- var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));\r
- echo "done!";\r
-?>\r
---EXPECT--\r
-bool(true)\r
-done!\r
+--TEST--
+Bug #55859 mysqli->stat property access gives error
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
+ echo "done!";
+?>
+--EXPECT--
+bool(true)
+done!
---TEST--\r
-Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()\r
---SKIPIF--\r
-<?php\r
-require_once('skipif.inc');\r
-require_once('skipifconnectfailure.inc');\r
-?>\r
---FILE--\r
-<?php\r
- require_once("connect.inc");\r
-\r
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {\r
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());\r
- }\r
- if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {\r
- printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));\r
- }\r
- if (FALSE === $stmt->execute()) {\r
- printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error); \r
- }\r
- if (FALSE === $stmt->store_result()) {\r
- printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); \r
- }\r
- $one = NULL;\r
- if (FALSE === $stmt->bind_result($one)) {\r
- printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); \r
- }\r
- if (FALSE === $stmt->reset()) {\r
- printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);\r
- }\r
- while ($stmt->fetch()) {\r
- var_dump($one);\r
- }\r
- $stmt->close();\r
- $link->close();\r
- echo "done!";\r
-?>\r
---EXPECT--\r
-int(42)\r
+--TEST--
+Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
+ printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (FALSE === $stmt->execute()) {
+ printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ if (FALSE === $stmt->store_result()) {
+ printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ $one = NULL;
+ if (FALSE === $stmt->bind_result($one)) {
+ printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ if (FALSE === $stmt->reset()) {
+ printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ while ($stmt->fetch()) {
+ var_dump($one);
+ }
+ $stmt->close();
+ $link->close();
+ echo "done!";
+?>
+--EXPECT--
+int(42)
done!
\ No newline at end of file
---TEST--\r
-Bug #62885 (mysqli_poll - Segmentation fault)\r
---SKIPIF--\r
-<?php\r
-require_once('skipif.inc');\r
-require_once("connect.inc");\r
-if (!$IS_MYSQLND) {\r
- die("skip mysqlnd only test");\r
-}\r
-?>\r
---FILE--\r
-<?php\r
-error_reporting(E_ALL);\r
-$tablica = array();\r
-$test1 = mysqli_poll($test2, $test3, $tablica, null);\r
-\r
-$test2 = array();\r
-$test2 = array();\r
-$test1 = mysqli_poll($test2, $test3, $tablica, null);\r
-echo "okey";\r
-?>\r
---EXPECTF--\r
-Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d\r
-\r
-Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d\r
-okey\r
+--TEST--
+Bug #62885 (mysqli_poll - Segmentation fault)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once("connect.inc");
+if (!$IS_MYSQLND) {
+ die("skip mysqlnd only test");
+}
+?>
+--FILE--
+<?php
+error_reporting(E_ALL);
+$tablica = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+
+$test2 = array();
+$test2 = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+echo "okey";
+?>
+--EXPECTF--
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
+
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
+okey
---TEST--\r
-Bug #69864 (Segfault in preg_replace_callback)\r
---SKIPIF--\r
-<?php\r
-if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");\r
-?>\r
---FILE--\r
-<?php\r
-/* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */\r
-\r
-const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c\r
-\r
-var_dump(preg_replace_callback('/a/', function($m) {\r
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {\r
- preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');\r
- }\r
- return 'b';\r
-}, 'aa'));\r
-var_dump(preg_replace_callback('/a/', function($m) {\r
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {\r
- preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');\r
- }\r
- return 'b';\r
-}, 'aa'));\r
-var_dump(preg_replace_callback('/a/', function($m) {\r
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {\r
- preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');\r
- }\r
- return 'b';\r
-}, 'aa'));\r
-var_dump(preg_replace_callback('/a/', function($m) {\r
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {\r
- preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);\r
- }\r
- return 'b';\r
-}, 'aa'));\r
-?>\r
---EXPECT--\r
-string(2) "bb"\r
-string(2) "bb"\r
-string(2) "bb"\r
-string(2) "bb"\r
+--TEST--
+Bug #69864 (Segfault in preg_replace_callback)
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
+--FILE--
+<?php
+/* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */
+
+const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
+
+var_dump(preg_replace_callback('/a/', function($m) {
+ for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
+ preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
+ }
+ return 'b';
+}, 'aa'));
+var_dump(preg_replace_callback('/a/', function($m) {
+ for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
+ preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
+ }
+ return 'b';
+}, 'aa'));
+var_dump(preg_replace_callback('/a/', function($m) {
+ for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
+ preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
+ }
+ return 'b';
+}, 'aa'));
+var_dump(preg_replace_callback('/a/', function($m) {
+ for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
+ preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
+ }
+ return 'b';
+}, 'aa'));
+?>
+--EXPECT--
+string(2) "bb"
+string(2) "bb"
+string(2) "bb"
+string(2) "bb"
---TEST--\r
-Bug #73612 (preg_*() may leak memory)\r
---FILE--\r
-<?php\r
-$obj = new stdClass;\r
-$obj->obj = $obj;\r
-preg_match('/./', 'x', $obj);\r
-\r
-$obj = new stdClass;\r
-$obj->obj = $obj;\r
-preg_replace('/./', '', 'x', -1, $obj);\r
-\r
-$obj = new stdClass;\r
-$obj->obj = $obj;\r
-preg_replace_callback('/./', 'count', 'x', -1, $obj);\r
-\r
-$obj = new stdClass;\r
-$obj->obj = $obj;\r
-preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);\r
-\r
-$obj = new stdClass;\r
-$obj->obj = $obj;\r
-preg_filter('/./', '', 'x', -1, $obj);\r
-?>\r
-===DONE===\r
---EXPECT--\r
-===DONE===\r
+--TEST--
+Bug #73612 (preg_*() may leak memory)
+--FILE--
+<?php
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_match('/./', 'x', $obj);
+
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_replace('/./', '', 'x', -1, $obj);
+
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_replace_callback('/./', 'count', 'x', -1, $obj);
+
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);
+
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_filter('/./', '', 'x', -1, $obj);
+?>
+===DONE===
+--EXPECT--
+===DONE===
---TEST--\r
-PDO_MYSQL: Defining a connection charset in the DSN\r
---SKIPIF--\r
-<?php\r
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');\r
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');\r
-MySQLPDOTest::skip();\r
-?>\r
---FILE--\r
-<?php\r
- require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');\r
-\r
- /* Connect to mysql to determine the current charset so we can diffinate it */\r
- $link = MySQLPDOTest::factory();\r
- $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;\r
-\r
- /* Make sure that we don't attempt to set the current character set to make this case useful */\r
- $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');\r
-\r
- /* Done with the original connection, create a second link to test the character set being defined */\r
- unset($link);\r
-\r
- $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));\r
- $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;\r
-\r
- if ($charset !== $conn_charset) {\r
- echo "done!\n";\r
- } else {\r
- echo "failed!\n";\r
- }\r
-?>\r
---EXPECTF--\r
-done!\r
+--TEST--
+PDO_MYSQL: Defining a connection charset in the DSN
+--SKIPIF--
+<?php
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+MySQLPDOTest::skip();
+?>
+--FILE--
+<?php
+ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ /* Connect to mysql to determine the current charset so we can diffinate it */
+ $link = MySQLPDOTest::factory();
+ $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
+
+ /* Make sure that we don't attempt to set the current character set to make this case useful */
+ $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
+
+ /* Done with the original connection, create a second link to test the character set being defined */
+ unset($link);
+
+ $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
+ $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
+
+ if ($charset !== $conn_charset) {
+ echo "done!\n";
+ } else {
+ echo "failed!\n";
+ }
+?>
+--EXPECTF--
+done!
---TEST--\r
-PostgreSQL non-blocking async query params\r
---SKIPIF--\r
-<?php\r
-include("skipif.inc");\r
-if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');\r
-?>\r
---FILE--\r
-<?php\r
-\r
-include('config.inc');\r
-include('nonblocking.inc');\r
-\r
-$db = pg_connect($conn_str);\r
-\r
-$version = pg_version($db);\r
-if ($version['protocol'] < 3) {\r
- echo "OK";\r
- exit(0);\r
-}\r
-\r
-$db_socket = pg_socket($db);\r
-stream_set_blocking($db_socket, false);\r
-\r
-$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));\r
-if ($sent === FALSE) {\r
- echo "pg_send_query_params() error\n";\r
-} elseif ($sent === 0) {\r
- nb_flush($db, $db_socket);\r
-}\r
-\r
-nb_consume($db, $db_socket);\r
-\r
-if (!($result = pg_get_result($db))) {\r
- echo "pg_get_result() error\n";\r
-}\r
-if (!($rows = pg_num_rows($result))) {\r
- echo "pg_num_rows() error\n";\r
-}\r
-for ($i=0; $i < $rows; $i++) {\r
- pg_fetch_array($result, $i, PGSQL_NUM);\r
-}\r
-for ($i=0; $i < $rows; $i++) {\r
- pg_fetch_object($result);\r
-}\r
-for ($i=0; $i < $rows; $i++) {\r
- pg_fetch_row($result, $i);\r
-}\r
-for ($i=0; $i < $rows; $i++) {\r
- pg_fetch_result($result, $i, 0);\r
-}\r
-\r
-pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));\r
-pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));\r
-pg_field_name($result, 0);\r
-pg_field_num($result, $field_name);\r
-pg_field_size($result, 0);\r
-pg_field_type($result, 0);\r
-pg_field_prtlen($result, 0);\r
-pg_field_is_null($result, 0);\r
-\r
-$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));\r
-\r
-if ($sent === FALSE) {\r
- echo "pg_send_query_params() error\n";\r
-} elseif ($sent === 0) {\r
- nb_flush($db, $db_socket);\r
-}\r
-\r
-pg_last_oid($result);\r
-pg_free_result($result);\r
-\r
-pg_close($db);\r
-\r
-echo "OK";\r
-?>\r
---EXPECT--\r
-OK\r
+--TEST--
+PostgreSQL non-blocking async query params
+--SKIPIF--
+<?php
+include("skipif.inc");
+if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
+?>
+--FILE--
+<?php
+
+include('config.inc');
+include('nonblocking.inc');
+
+$db = pg_connect($conn_str);
+
+$version = pg_version($db);
+if ($version['protocol'] < 3) {
+ echo "OK";
+ exit(0);
+}
+
+$db_socket = pg_socket($db);
+stream_set_blocking($db_socket, false);
+
+$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
+if ($sent === FALSE) {
+ echo "pg_send_query_params() error\n";
+} elseif ($sent === 0) {
+ nb_flush($db, $db_socket);
+}
+
+nb_consume($db, $db_socket);
+
+if (!($result = pg_get_result($db))) {
+ echo "pg_get_result() error\n";
+}
+if (!($rows = pg_num_rows($result))) {
+ echo "pg_num_rows() error\n";
+}
+for ($i=0; $i < $rows; $i++) {
+ pg_fetch_array($result, $i, PGSQL_NUM);
+}
+for ($i=0; $i < $rows; $i++) {
+ pg_fetch_object($result);
+}
+for ($i=0; $i < $rows; $i++) {
+ pg_fetch_row($result, $i);
+}
+for ($i=0; $i < $rows; $i++) {
+ pg_fetch_result($result, $i, 0);
+}
+
+pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+pg_field_name($result, 0);
+pg_field_num($result, $field_name);
+pg_field_size($result, 0);
+pg_field_type($result, 0);
+pg_field_prtlen($result, 0);
+pg_field_is_null($result, 0);
+
+$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
+
+if ($sent === FALSE) {
+ echo "pg_send_query_params() error\n";
+} elseif ($sent === 0) {
+ nb_flush($db, $db_socket);
+}
+
+pg_last_oid($result);
+pg_free_result($result);
+
+pg_close($db);
+
+echo "OK";
+?>
+--EXPECT--
+OK
---TEST--\r
-bug#53872 (internal corruption of phar)\r
---SKIPIF--\r
-<?php \r
-if (!extension_loaded("phar")) die("skip"); \r
-if (!extension_loaded("zlib")) die("skip Test needs ext/zlib"); \r
-?>\r
---INI--\r
-phar.readonly=0\r
---FILE--\r
-<?php\r
-$p=new Phar('bug53872-phar.phar');\r
-$p->buildFromDirectory(__DIR__ . "/bug53872/");\r
-$p->setStub('<?php __HALT_COMPILER();?\>');\r
-$p->compressFiles(Phar::GZ);\r
-\r
-print(file_get_contents('phar://bug53872-phar.phar/first.txt'));\r
-print(file_get_contents('phar://bug53872-phar.phar/second.txt'));\r
-print(file_get_contents('phar://bug53872-phar.phar/third.txt'));\r
-?>\r
---CLEAN--\r
-<?php\r
-unlink("bug53872-phar.phar");\r
-?>\r
---EXPECT--\r
-content of first.txt\r
-content of third.txt\r
-\r
+--TEST--
+bug#53872 (internal corruption of phar)
+--SKIPIF--
+<?php
+if (!extension_loaded("phar")) die("skip");
+if (!extension_loaded("zlib")) die("skip Test needs ext/zlib");
+?>
+--INI--
+phar.readonly=0
+--FILE--
+<?php
+$p=new Phar('bug53872-phar.phar');
+$p->buildFromDirectory(__DIR__ . "/bug53872/");
+$p->setStub('<?php __HALT_COMPILER();?\>');
+$p->compressFiles(Phar::GZ);
+
+print(file_get_contents('phar://bug53872-phar.phar/first.txt'));
+print(file_get_contents('phar://bug53872-phar.phar/second.txt'));
+print(file_get_contents('phar://bug53872-phar.phar/third.txt'));
+?>
+--CLEAN--
+<?php
+unlink("bug53872-phar.phar");
+?>
+--EXPECT--
+content of first.txt
+content of third.txt
+
---TEST--\r
-Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d\r
---SKIPIF--\r
-<?php if (!extension_loaded("phar")) die("skip");\r
-if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");\r
-?>\r
---INI--\r
-phar.readonly=0\r
---FILE--\r
-<?php\r
-Phar::interceptFileFuncs();\r
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';\r
-$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';\r
-$pname = 'phar://' . $fname;\r
-file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');\r
-file_put_contents($pname . '/foo/hi', '<?php\r
-include "' . addslashes($fname2) . '";\r
-readfile("foo/hi");\r
-fopen("foo/hi", "r");\r
-echo file_get_contents("foo/hi");\r
-var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));\r
-opendir("foo/hi");\r
-?>\r
-');\r
-include $pname . '/foo/hi';\r
-?>\r
-===DONE===\r
---CLEAN--\r
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>\r
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>\r
---EXPECTF--\r
-Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d\r
-\r
-Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d\r
-\r
-Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d\r
-\r
-Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d\r
-bool(false)\r
-bool(false)\r
-bool(false)\r
-bool(false)\r
-bool(false)\r
-\r
-Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d\r
-\r
-Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d\r
-===DONE===\r
+--TEST--
+Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip");
+if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
+?>
+--INI--
+phar.readonly=0
+--FILE--
+<?php
+Phar::interceptFileFuncs();
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
+$pname = 'phar://' . $fname;
+file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
+file_put_contents($pname . '/foo/hi', '<?php
+include "' . addslashes($fname2) . '";
+readfile("foo/hi");
+fopen("foo/hi", "r");
+echo file_get_contents("foo/hi");
+var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
+opendir("foo/hi");
+?>
+');
+include $pname . '/foo/hi';
+?>
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
+--EXPECTF--
+Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+
+Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+
+Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+
+Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+
+Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+===DONE===
---TEST--\r
-ReflectionParameter class - canBePassedByValue() method.\r
---FILE--\r
-<?php\r
-\r
-function aux($fun) {\r
-\r
- $func = new ReflectionFunction($fun);\r
- $parameters = $func->getParameters();\r
- foreach($parameters as $parameter) {\r
- echo "Name: ", $parameter->getName(), "\n";\r
- echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";\r
- echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";\r
- echo "\n";\r
- }\r
-\r
-}\r
-\r
-echo "=> array_multisort:\n\n";\r
-\r
-aux('array_multisort');\r
-\r
-\r
-echo "=> sort:\n\n";\r
-\r
-aux('sort');\r
-\r
-echo "=> user function:\n\n";\r
-\r
-function ufunc(&$arg1, $arg2) {}\r
-\r
-aux('ufunc');\r
-\r
-echo "Done.\n";\r
-\r
-?>\r
---EXPECTF--\r
-=> array_multisort:\r
-\r
-Name: arr1\r
-Is passed by reference: yes\r
-Can be passed by value: yes\r
-\r
-Name: sort_order\r
-Is passed by reference: yes\r
-Can be passed by value: yes\r
-\r
-Name: sort_flags\r
-Is passed by reference: yes\r
-Can be passed by value: yes\r
-\r
-Name: arr2\r
-Is passed by reference: yes\r
-Can be passed by value: yes\r
-\r
-=> sort:\r
-\r
-Name: arg\r
-Is passed by reference: yes\r
-Can be passed by value: no\r
-\r
-Name: sort_flags\r
-Is passed by reference: no\r
-Can be passed by value: yes\r
-\r
-=> user function:\r
-\r
-Name: arg1\r
-Is passed by reference: yes\r
-Can be passed by value: no\r
-\r
-Name: arg2\r
-Is passed by reference: no\r
-Can be passed by value: yes\r
-\r
-Done.\r
+--TEST--
+ReflectionParameter class - canBePassedByValue() method.
+--FILE--
+<?php
+
+function aux($fun) {
+
+ $func = new ReflectionFunction($fun);
+ $parameters = $func->getParameters();
+ foreach($parameters as $parameter) {
+ echo "Name: ", $parameter->getName(), "\n";
+ echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
+ echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
+ echo "\n";
+ }
+
+}
+
+echo "=> array_multisort:\n\n";
+
+aux('array_multisort');
+
+
+echo "=> sort:\n\n";
+
+aux('sort');
+
+echo "=> user function:\n\n";
+
+function ufunc(&$arg1, $arg2) {}
+
+aux('ufunc');
+
+echo "Done.\n";
+
+?>
+--EXPECTF--
+=> array_multisort:
+
+Name: arr1
+Is passed by reference: yes
+Can be passed by value: yes
+
+Name: sort_order
+Is passed by reference: yes
+Can be passed by value: yes
+
+Name: sort_flags
+Is passed by reference: yes
+Can be passed by value: yes
+
+Name: arr2
+Is passed by reference: yes
+Can be passed by value: yes
+
+=> sort:
+
+Name: arg
+Is passed by reference: yes
+Can be passed by value: no
+
+Name: sort_flags
+Is passed by reference: no
+Can be passed by value: yes
+
+=> user function:
+
+Name: arg1
+Is passed by reference: yes
+Can be passed by value: no
+
+Name: arg2
+Is passed by reference: no
+Can be passed by value: yes
+
+Done.
---TEST--\r
-ReflectionParameter::isDefault()\r
---FILE--\r
-<?php\r
-class A {\r
-public $defprop;\r
-}\r
-$a = new A;\r
-$a->myprop = null;\r
-\r
-$ro = new ReflectionObject($a);\r
-$props = $ro->getProperties();\r
-$prop1 = $props[0];\r
-var_dump($prop1->isDefault());\r
-$prop2 = $props[1];\r
-var_dump($prop2->isDefault());\r
-\r
-var_dump($ro->getProperty('defprop')->isDefault());\r
-var_dump($ro->getProperty('myprop')->isDefault());\r
-\r
-$prop1 = new ReflectionProperty($a, 'defprop');\r
-$prop2 = new ReflectionProperty($a, 'myprop');\r
-var_dump($prop1->isDefault());\r
-var_dump($prop2->isDefault());\r
-?>\r
-==DONE==\r
---EXPECT--\r
-bool(true)\r
-bool(false)\r
-bool(true)\r
-bool(false)\r
-bool(true)\r
-bool(false)\r
-==DONE==\r
+--TEST--
+ReflectionParameter::isDefault()
+--FILE--
+<?php
+class A {
+public $defprop;
+}
+$a = new A;
+$a->myprop = null;
+
+$ro = new ReflectionObject($a);
+$props = $ro->getProperties();
+$prop1 = $props[0];
+var_dump($prop1->isDefault());
+$prop2 = $props[1];
+var_dump($prop2->isDefault());
+
+var_dump($ro->getProperty('defprop')->isDefault());
+var_dump($ro->getProperty('myprop')->isDefault());
+
+$prop1 = new ReflectionProperty($a, 'defprop');
+$prop2 = new ReflectionProperty($a, 'myprop');
+var_dump($prop1->isDefault());
+var_dump($prop2->isDefault());
+?>
+==DONE==
+--EXPECT--
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+==DONE==
-@ECHO OFF\r
-SETLOCAL ENABLEDELAYEDEXPANSION\r
-\r
-IF _%1_==_AUTO_ (\r
- GOTO MakeDirs\r
-)\r
-\r
-IF _%2_==__ (\r
- ECHO Usage %0 ^<basedir^> ^<depth^> ^[^hash_bits^]\r
- ECHO.\r
- ECHO Where ^<basedir^> is the session directory \r
- ECHO ^<depth^> is the number of levels defined in session.save_path\r
- ECHO ^[hash_bits^] is the number of bits defined in session.hash_bits_per_character\r
- EXIT /B 1\r
-)\r
-\r
-SET /A Depth=%2 + 0 2>NUL\r
-IF /I %ERRORLEVEL% EQU 9167 GOTO DepthError\r
-IF _%Depth%_==__ GOTO DepthError\r
-IF /I %Depth% LEQ 0 GOTO DepthError\r
-\r
-IF _%3_==__ GOTO DefaultBits\r
-\r
-SET /A Bits=%3 + 0 2>NUL\r
-IF /I %ERRORLEVEL% EQU 9167 GOTO BitsError\r
-IF _%Bits%_==__ GOTO BitsError\r
-IF /I %Bits% LSS 4 GOTO BitsError\r
-IF /I %Bits% GTR 6 GOTO BitsError\r
-GOTO BitsSet\r
-\r
-:DefaultBits\r
-SET Bits=4\r
-:BitsSet\r
-\r
-SET HashChars=0 1 2 3 4 5 6 7 8 9 A B C D E F\r
-IF /I %Bits% GEQ 5 SET HashChars=!HashChars! G H I J K L M N O P Q R S T U V\r
-IF /I %Bits% GEQ 6 SET HashChars=!HashChars! W X Y Z - ,\r
-\r
-FOR %%A IN (%HashChars%) DO (\r
- ECHO Making %%A\r
- CALL "%~0" AUTO "%~1\%%~A" %Depth%\r
-)\r
-GOTO :EOF\r
-\r
-:MakeDirs\r
-MKDIR "%~2"\r
-SET /A ThisDepth=%3 - 1\r
-IF /I %ThisDepth% GTR 0 FOR %%A IN (%HashChars%) DO CALL "%~0" AUTO "%~2\%%~A" %ThisDepth%\r
-GOTO :EOF\r
-\r
-:DepthError\r
-ECHO ERROR: Invalid depth : %2\r
-EXIT /B 0\r
-\r
-:BitsError\r
-ECHO ERROR: Invalid hash_bits : %3\r
-EXIT /B 0\r
+@ECHO OFF
+SETLOCAL ENABLEDELAYEDEXPANSION
+
+IF _%1_==_AUTO_ (
+ GOTO MakeDirs
+)
+
+IF _%2_==__ (
+ ECHO Usage %0 ^<basedir^> ^<depth^> ^[^hash_bits^]
+ ECHO.
+ ECHO Where ^<basedir^> is the session directory
+ ECHO ^<depth^> is the number of levels defined in session.save_path
+ ECHO ^[hash_bits^] is the number of bits defined in session.hash_bits_per_character
+ EXIT /B 1
+)
+
+SET /A Depth=%2 + 0 2>NUL
+IF /I %ERRORLEVEL% EQU 9167 GOTO DepthError
+IF _%Depth%_==__ GOTO DepthError
+IF /I %Depth% LEQ 0 GOTO DepthError
+
+IF _%3_==__ GOTO DefaultBits
+
+SET /A Bits=%3 + 0 2>NUL
+IF /I %ERRORLEVEL% EQU 9167 GOTO BitsError
+IF _%Bits%_==__ GOTO BitsError
+IF /I %Bits% LSS 4 GOTO BitsError
+IF /I %Bits% GTR 6 GOTO BitsError
+GOTO BitsSet
+
+:DefaultBits
+SET Bits=4
+:BitsSet
+
+SET HashChars=0 1 2 3 4 5 6 7 8 9 A B C D E F
+IF /I %Bits% GEQ 5 SET HashChars=!HashChars! G H I J K L M N O P Q R S T U V
+IF /I %Bits% GEQ 6 SET HashChars=!HashChars! W X Y Z - ,
+
+FOR %%A IN (%HashChars%) DO (
+ ECHO Making %%A
+ CALL "%~0" AUTO "%~1\%%~A" %Depth%
+)
+GOTO :EOF
+
+:MakeDirs
+MKDIR "%~2"
+SET /A ThisDepth=%3 - 1
+IF /I %ThisDepth% GTR 0 FOR %%A IN (%HashChars%) DO CALL "%~0" AUTO "%~2\%%~A" %ThisDepth%
+GOTO :EOF
+
+:DepthError
+ECHO ERROR: Invalid depth : %2
+EXIT /B 0
+
+:BitsError
+ECHO ERROR: Invalid hash_bits : %3
+EXIT /B 0
---TEST--\r
-Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)\r
---SKIPIF--\r
-<?php include('skipif.inc'); ?>\r
---INI--\r
-session.use_trans_sid=1\r
-session.use_cookies=0\r
-session.use_only_cookies=0\r
-session.name=sid\r
---FILE--\r
-<?php\r
-error_reporting(E_ALL);\r
-\r
-session_start();\r
-\r
-# Do not remove \r from this tests, they are essential!\r
-?>\r
-<html>\r
- <head>\r
- <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>\r
- </head>\r
- <body>\r
- <p>See source html code</p>\r
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2"\r
- style="font: normal 11pt Times New Roman">incorrect link</a><br />\r
- <br />\r
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a>\r
- </body>\r
-</html>\r
---EXPECTF--\r
-<html>\r
- <head>\r
- <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>\r
- </head>\r
- <body>\r
- <p>See source html code</p>\r
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s"\r
- style="font: normal 11pt Times New Roman">incorrect link</a><br />\r
- <br />\r
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a>\r
- </body>\r
-</html>\r
+--TEST--
+Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_trans_sid=1
+session.use_cookies=0
+session.use_only_cookies=0
+session.name=sid
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+session_start();
+
+# Do not remove \r from this tests, they are essential!
+?>
+<html>
+ <head>
+ <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
+ </head>
+ <body>
+ <p>See source html code</p>
+ <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2"
+ style="font: normal 11pt Times New Roman">incorrect link</a><br />
+ <br />
+ <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a>
+ </body>
+</html>
+--EXPECTF--
+<html>
+ <head>
+ <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
+ </head>
+ <body>
+ <p>See source html code</p>
+ <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s"
+ style="font: normal 11pt Times New Roman">incorrect link</a><br />
+ <br />
+ <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a>
+ </body>
+</html>
---TEST--\r
-Bug #51958: socket_accept() fails on IPv6 server sockets\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('sockets')) {\r
- die('skip sockets extension not available.');\r
-}\r
-if (!defined('IPPROTO_IPV6')) {\r
- die('skip IPv6 not available.');\r
-}\r
-if (PHP_OS != "WINNT")\r
- die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');\r
---FILE--\r
-<?php\r
-$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);\r
-socket_bind($listenfd, "::1", 13579);\r
-socket_listen($listenfd);\r
-socket_set_nonblock($listenfd);\r
-$connfd = @socket_accept($listenfd);\r
-echo socket_last_error();\r
---EXPECT--\r
-10035\r
+--TEST--
+Bug #51958: socket_accept() fails on IPv6 server sockets
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) {
+ die('skip sockets extension not available.');
+}
+if (!defined('IPPROTO_IPV6')) {
+ die('skip IPv6 not available.');
+}
+if (PHP_OS != "WINNT")
+ die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
+--FILE--
+<?php
+$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
+socket_bind($listenfd, "::1", 13579);
+socket_listen($listenfd);
+socket_set_nonblock($listenfd);
+$connfd = @socket_accept($listenfd);
+echo socket_last_error();
+--EXPECT--
+10035
---TEST--\r
-Multicast support: IPv4 receive options\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('sockets')) {\r
- die('skip sockets extension not available.');\r
-}\r
-$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);\r
-$br = socket_bind($s, '0.0.0.0', 3000);\r
-$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(\r
- "group" => '224.0.0.23',\r
- "interface" => 'lo',\r
-));\r
-if ($so === false) {\r
- die('skip interface \'lo\' is unavailable.');\r
-}\r
-if (!defined("MCAST_BLOCK_SOURCE")) {\r
- die('skip source operations are unavailable');\r
-}\r
---FILE--\r
-<?php\r
-include __DIR__."/mcast_helpers.php.inc";\r
-$domain = AF_INET;\r
-$level = IPPROTO_IP;\r
-$interface = "lo";\r
-$mcastaddr = '224.0.0.23';\r
-$sblock = "127.0.0.1";\r
-\r
-echo "creating send socket bound to 127.0.0.1\n";\r
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);\r
-$br = socket_bind($sends1, '127.0.0.1');\r
-var_dump($br);\r
-\r
-echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n";\r
-$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);\r
-var_dump($br);\r
-\r
-echo "creating receive socket\n";\r
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);\r
-var_dump($s);\r
-$br = socket_bind($s, '0.0.0.0', 3000);\r
-var_dump($br);\r
-\r
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
-));\r
-var_dump($so);\r
-\r
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);\r
-var_dump($r);\r
-\r
-$i = 0;\r
-checktimeout($s, 500);\r
-while (($str = socket_read($s, 3000)) !== FALSE) {\r
- $i++;\r
- echo "$i> ", $str, "\n";\r
-\r
-if ($i == 1) {\r
- echo "leaving group\n";\r
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 2) {\r
- echo "re-joining group\n";\r
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 3) {\r
- echo "blocking source\n";\r
- $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 4) {\r
- echo "unblocking source\n";\r
- $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 5) {\r
- echo "leaving group\n";\r
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 6) {\r
- echo "joining source group\n";\r
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 7) {\r
- echo "leaving source group\n";\r
- $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 8) {\r
-/* echo "rjsg\n";\r
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);*/\r
- break;\r
-}\r
-\r
-}\r
---EXPECTF--\r
-creating send socket bound to 127.0.0.1\r
-bool(true)\r
-creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23\r
-bool(true)\r
-creating receive socket\r
-resource(%d) of type (Socket)\r
-bool(true)\r
-bool(true)\r
-int(14)\r
-1> initial packet\r
-leaving group\r
-bool(true)\r
-int(20)\r
-int(14)\r
-2> unicast packet\r
-re-joining group\r
-bool(true)\r
-int(42)\r
-int(12)\r
-3> mcast packet\r
-blocking source\r
-bool(true)\r
-int(31)\r
-int(14)\r
-4> unicast packet\r
-unblocking source\r
-bool(true)\r
-int(27)\r
-5> mcast packet from 127.0.0.1\r
-leaving group\r
-bool(true)\r
-int(20)\r
-int(14)\r
-6> unicast packet\r
-joining source group\r
-bool(true)\r
-int(27)\r
-7> mcast packet from 127.0.0.1\r
-leaving source group\r
-bool(true)\r
-int(20)\r
-int(14)\r
-8> unicast packet\r
+--TEST--
+Multicast support: IPv4 receive options
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) {
+ die('skip sockets extension not available.');
+}
+$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
+$br = socket_bind($s, '0.0.0.0', 3000);
+$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
+ "group" => '224.0.0.23',
+ "interface" => 'lo',
+));
+if ($so === false) {
+ die('skip interface \'lo\' is unavailable.');
+}
+if (!defined("MCAST_BLOCK_SOURCE")) {
+ die('skip source operations are unavailable');
+}
+--FILE--
+<?php
+include __DIR__."/mcast_helpers.php.inc";
+$domain = AF_INET;
+$level = IPPROTO_IP;
+$interface = "lo";
+$mcastaddr = '224.0.0.23';
+$sblock = "127.0.0.1";
+
+echo "creating send socket bound to 127.0.0.1\n";
+$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
+$br = socket_bind($sends1, '127.0.0.1');
+var_dump($br);
+
+echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n";
+$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
+var_dump($br);
+
+echo "creating receive socket\n";
+$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
+var_dump($s);
+$br = socket_bind($s, '0.0.0.0', 3000);
+var_dump($br);
+
+$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+));
+var_dump($so);
+
+$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
+var_dump($r);
+
+$i = 0;
+checktimeout($s, 500);
+while (($str = socket_read($s, 3000)) !== FALSE) {
+ $i++;
+ echo "$i> ", $str, "\n";
+
+if ($i == 1) {
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
+ var_dump($r);
+}
+if ($i == 2) {
+ echo "re-joining group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+}
+if ($i == 3) {
+ echo "blocking source\n";
+ $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
+ var_dump($r);
+}
+if ($i == 4) {
+ echo "unblocking source\n";
+ $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+}
+if ($i == 5) {
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
+ var_dump($r);
+}
+if ($i == 6) {
+ echo "joining source group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+}
+if ($i == 7) {
+ echo "leaving source group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
+ var_dump($r);
+}
+if ($i == 8) {
+/* echo "rjsg\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);*/
+ break;
+}
+
+}
+--EXPECTF--
+creating send socket bound to 127.0.0.1
+bool(true)
+creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23
+bool(true)
+creating receive socket
+resource(%d) of type (Socket)
+bool(true)
+bool(true)
+int(14)
+1> initial packet
+leaving group
+bool(true)
+int(20)
+int(14)
+2> unicast packet
+re-joining group
+bool(true)
+int(42)
+int(12)
+3> mcast packet
+blocking source
+bool(true)
+int(31)
+int(14)
+4> unicast packet
+unblocking source
+bool(true)
+int(27)
+5> mcast packet from 127.0.0.1
+leaving group
+bool(true)
+int(20)
+int(14)
+6> unicast packet
+joining source group
+bool(true)
+int(27)
+7> mcast packet from 127.0.0.1
+leaving source group
+bool(true)
+int(20)
+int(14)
+8> unicast packet
---TEST--\r
-Multicast support: IPv6 receive options\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('sockets')) {\r
- die('skip sockets extension not available.');\r
-}\r
-if (!defined('IPPROTO_IPV6')) {\r
- die('skip IPv6 not available.');\r
-}\r
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);\r
-if ($s === false) {\r
- die("skip unable to create socket");\r
-}\r
-$br = socket_bind($s, '::', 3000);\r
-/* On Linux, there is no route ff00::/8 by default on lo, which makes it\r
- * troublesome to send multicast traffic from lo, which we must since\r
- * we're dealing with interface-local traffic... */\r
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(\r
- "group" => 'ff01::114',\r
- "interface" => 0,\r
-));\r
-if ($so === false) {\r
- die('skip unable to join multicast group on any interface.');\r
-}\r
-$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);\r
-if ($r === false) {\r
- die('skip unable to send multicast packet.');\r
-}\r
-\r
-if (!defined("MCAST_JOIN_SOURCE_GROUP"))\r
- die('skip source operations are unavailable');\r
-\r
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(\r
- "group" => 'ff01::114',\r
- "interface" => 0,\r
-));\r
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(\r
- "group" => 'ff01::114',\r
- "interface" => 0,\r
- "source" => '2001::dead:beef',\r
-));\r
-if ($so === false) {\r
- die('skip protocol independent multicast API is unavailable.');\r
-}\r
-\r
---FILE--\r
-<?php\r
-include __DIR__."/mcast_helpers.php.inc";\r
-$domain = AF_INET6;\r
-$level = IPPROTO_IPV6;\r
-$interface = 0;\r
-$mcastaddr = 'ff01::114';\r
-$sblock = "?";\r
-\r
-echo "creating send socket\n";\r
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");\r
-var_dump($sends1);\r
-\r
-echo "creating receive socket\n";\r
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");\r
-var_dump($s);\r
-$br = socket_bind($s, '::0', 3000) or die("err");\r
-var_dump($br);\r
-\r
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
-)) or die("err");\r
-var_dump($so);\r
-\r
-$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);\r
-var_dump($r);\r
-checktimeout($s, 500);\r
-$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);\r
-var_dump($r, $str, $from);\r
-$sblock = $from;\r
-\r
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);\r
-var_dump($r);\r
-\r
-$i = 0;\r
-checktimeout($s, 500);\r
-while (($str = socket_read($s, 3000)) !== FALSE) {\r
- $i++;\r
- echo "$i> ", $str, "\n";\r
-\r
-if ($i == 1) {\r
- echo "leaving group\n";\r
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 2) {\r
- echo "re-joining group\n";\r
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 3) {\r
- echo "blocking source\n";\r
- $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 4) {\r
- echo "unblocking source\n";\r
- $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 5) {\r
- echo "leaving group\n";\r
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 6) {\r
- echo "joining source group\n";\r
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 7) {\r
- echo "leaving source group\n";\r
- $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 8) {\r
- /*echo "joining source group\n";\r
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- "source" => $sblock,\r
- ));\r
- var_dump($so);*/\r
- break;\r
-}\r
-\r
-}\r
---EXPECTF--\r
-creating send socket\r
-resource(%d) of type (Socket)\r
-creating receive socket\r
-resource(%d) of type (Socket)\r
-bool(true)\r
-bool(true)\r
-int(14)\r
-int(14)\r
-string(14) "testing packet"\r
-string(%d) "%s"\r
-int(14)\r
-1> initial packet\r
-leaving group\r
-bool(true)\r
-int(20)\r
-int(14)\r
-2> unicast packet\r
-re-joining group\r
-bool(true)\r
-int(12)\r
-3> mcast packet\r
-blocking source\r
-bool(true)\r
-int(31)\r
-int(14)\r
-4> unicast packet\r
-unblocking source\r
-bool(true)\r
-int(12)\r
-5> mcast packet\r
-leaving group\r
-bool(true)\r
-int(20)\r
-int(14)\r
-6> unicast packet\r
-joining source group\r
-bool(true)\r
-int(32)\r
-7> mcast packet from desired source\r
-leaving source group\r
-bool(true)\r
-int(20)\r
-int(14)\r
-8> unicast packet\r
+--TEST--
+Multicast support: IPv6 receive options
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) {
+ die('skip sockets extension not available.');
+}
+if (!defined('IPPROTO_IPV6')) {
+ die('skip IPv6 not available.');
+}
+$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
+if ($s === false) {
+ die("skip unable to create socket");
+}
+$br = socket_bind($s, '::', 3000);
+/* On Linux, there is no route ff00::/8 by default on lo, which makes it
+ * troublesome to send multicast traffic from lo, which we must since
+ * we're dealing with interface-local traffic... */
+$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
+ "group" => 'ff01::114',
+ "interface" => 0,
+));
+if ($so === false) {
+ die('skip unable to join multicast group on any interface.');
+}
+$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
+if ($r === false) {
+ die('skip unable to send multicast packet.');
+}
+
+if (!defined("MCAST_JOIN_SOURCE_GROUP"))
+ die('skip source operations are unavailable');
+
+$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
+ "group" => 'ff01::114',
+ "interface" => 0,
+));
+$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
+ "group" => 'ff01::114',
+ "interface" => 0,
+ "source" => '2001::dead:beef',
+));
+if ($so === false) {
+ die('skip protocol independent multicast API is unavailable.');
+}
+
+--FILE--
+<?php
+include __DIR__."/mcast_helpers.php.inc";
+$domain = AF_INET6;
+$level = IPPROTO_IPV6;
+$interface = 0;
+$mcastaddr = 'ff01::114';
+$sblock = "?";
+
+echo "creating send socket\n";
+$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
+var_dump($sends1);
+
+echo "creating receive socket\n";
+$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
+var_dump($s);
+$br = socket_bind($s, '::0', 3000) or die("err");
+var_dump($br);
+
+$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+)) or die("err");
+var_dump($so);
+
+$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
+var_dump($r);
+checktimeout($s, 500);
+$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
+var_dump($r, $str, $from);
+$sblock = $from;
+
+$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
+var_dump($r);
+
+$i = 0;
+checktimeout($s, 500);
+while (($str = socket_read($s, 3000)) !== FALSE) {
+ $i++;
+ echo "$i> ", $str, "\n";
+
+if ($i == 1) {
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
+}
+if ($i == 2) {
+ echo "re-joining group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+}
+if ($i == 3) {
+ echo "blocking source\n";
+ $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
+}
+if ($i == 4) {
+ echo "unblocking source\n";
+ $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+}
+if ($i == 5) {
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
+}
+if ($i == 6) {
+ echo "joining source group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+}
+if ($i == 7) {
+ echo "leaving source group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
+}
+if ($i == 8) {
+ /*echo "joining source group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);*/
+ break;
+}
+
+}
+--EXPECTF--
+creating send socket
+resource(%d) of type (Socket)
+creating receive socket
+resource(%d) of type (Socket)
+bool(true)
+bool(true)
+int(14)
+int(14)
+string(14) "testing packet"
+string(%d) "%s"
+int(14)
+1> initial packet
+leaving group
+bool(true)
+int(20)
+int(14)
+2> unicast packet
+re-joining group
+bool(true)
+int(12)
+3> mcast packet
+blocking source
+bool(true)
+int(31)
+int(14)
+4> unicast packet
+unblocking source
+bool(true)
+int(12)
+5> mcast packet
+leaving group
+bool(true)
+int(20)
+int(14)
+6> unicast packet
+joining source group
+bool(true)
+int(32)
+7> mcast packet from desired source
+leaving source group
+bool(true)
+int(20)
+int(14)
+8> unicast packet
---TEST--\r
-Multicast support: IPv6 receive options (limited)\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('sockets')) {\r
- die('skip sockets extension not available.');\r
-}\r
-if (!defined('IPPROTO_IPV6')) {\r
- die('skip IPv6 not available.');\r
-}\r
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);\r
-$br = socket_bind($s, '::', 3000);\r
-/* On Linux, there is no route ff00::/8 by default on lo, which makes it\r
- * troublesome to send multicast traffic from lo, which we must since\r
- * we're dealing with interface-local traffic... */\r
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(\r
- "group" => 'ff01::114',\r
- "interface" => 0,\r
-));\r
-if ($so === false) {\r
- die('skip unable to join multicast group on any interface.');\r
-}\r
-$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);\r
-if ($r === false) {\r
- die('skip unable to send multicast packet.');\r
-}\r
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(\r
- "group" => 'ff01::114',\r
- "interface" => 0,\r
-));\r
-if (defined("MCAST_JOIN_SOURCE_GROUP")) {\r
- $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(\r
- "group" => 'ff01::114',\r
- "interface" => 0,\r
- "source" => '2001::dead:beef',\r
- ));\r
- if ($so !== false) {\r
- die('skip protocol independent multicast API is available.');\r
- }\r
-}\r
-\r
---FILE--\r
-<?php\r
-include __DIR__."/mcast_helpers.php.inc";\r
-$domain = AF_INET6;\r
-$level = IPPROTO_IPV6;\r
-$interface = 0;\r
-$mcastaddr = 'ff01::114';\r
-$sblock = "?";\r
-\r
-echo "creating send socket\n";\r
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");\r
-var_dump($sends1);\r
-\r
-echo "creating receive socket\n";\r
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");\r
-var_dump($s);\r
-$br = socket_bind($s, '::0', 3000) or die("err");\r
-var_dump($br);\r
-\r
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
-)) or die("err");\r
-var_dump($so);\r
-\r
-$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);\r
-var_dump($r);\r
-checktimeout($s, 500);\r
-$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);\r
-var_dump($r, $str, $from);\r
-$sblock = $from;\r
-\r
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);\r
-var_dump($r);\r
-\r
-$i = 0;\r
-checktimeout($s, 500);\r
-while (($str = socket_read($s, 3000, 500)) !== FALSE) {\r
- $i++;\r
- echo "$i> ", $str, "\n";\r
-\r
-if ($i == 1) {\r
- echo "leaving group\n";\r
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 2) {\r
- echo "re-joining group\n";\r
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(\r
- "group" => $mcastaddr,\r
- "interface" => $interface,\r
- ));\r
- var_dump($so);\r
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);\r
- var_dump($r);\r
-}\r
-if ($i == 3) {\r
- break;\r
-}\r
-\r
-}\r
---EXPECTF--\r
-creating send socket\r
-resource(%d) of type (Socket)\r
-creating receive socket\r
-resource(%d) of type (Socket)\r
-bool(true)\r
-bool(true)\r
-int(14)\r
-int(14)\r
-string(14) "testing packet"\r
-string(%d) "%s"\r
-int(14)\r
-1> initial packet\r
-leaving group\r
-bool(true)\r
-int(20)\r
-int(14)\r
-2> unicast packet\r
-re-joining group\r
-bool(true)\r
-int(12)\r
-3> mcast packet\r
+--TEST--
+Multicast support: IPv6 receive options (limited)
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) {
+ die('skip sockets extension not available.');
+}
+if (!defined('IPPROTO_IPV6')) {
+ die('skip IPv6 not available.');
+}
+$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
+$br = socket_bind($s, '::', 3000);
+/* On Linux, there is no route ff00::/8 by default on lo, which makes it
+ * troublesome to send multicast traffic from lo, which we must since
+ * we're dealing with interface-local traffic... */
+$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
+ "group" => 'ff01::114',
+ "interface" => 0,
+));
+if ($so === false) {
+ die('skip unable to join multicast group on any interface.');
+}
+$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
+if ($r === false) {
+ die('skip unable to send multicast packet.');
+}
+$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
+ "group" => 'ff01::114',
+ "interface" => 0,
+));
+if (defined("MCAST_JOIN_SOURCE_GROUP")) {
+ $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
+ "group" => 'ff01::114',
+ "interface" => 0,
+ "source" => '2001::dead:beef',
+ ));
+ if ($so !== false) {
+ die('skip protocol independent multicast API is available.');
+ }
+}
+
+--FILE--
+<?php
+include __DIR__."/mcast_helpers.php.inc";
+$domain = AF_INET6;
+$level = IPPROTO_IPV6;
+$interface = 0;
+$mcastaddr = 'ff01::114';
+$sblock = "?";
+
+echo "creating send socket\n";
+$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
+var_dump($sends1);
+
+echo "creating receive socket\n";
+$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
+var_dump($s);
+$br = socket_bind($s, '::0', 3000) or die("err");
+var_dump($br);
+
+$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+)) or die("err");
+var_dump($so);
+
+$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
+var_dump($r);
+checktimeout($s, 500);
+$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
+var_dump($r, $str, $from);
+$sblock = $from;
+
+$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
+var_dump($r);
+
+$i = 0;
+checktimeout($s, 500);
+while (($str = socket_read($s, 3000, 500)) !== FALSE) {
+ $i++;
+ echo "$i> ", $str, "\n";
+
+if ($i == 1) {
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
+}
+if ($i == 2) {
+ echo "re-joining group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+}
+if ($i == 3) {
+ break;
+}
+
+}
+--EXPECTF--
+creating send socket
+resource(%d) of type (Socket)
+creating receive socket
+resource(%d) of type (Socket)
+bool(true)
+bool(true)
+int(14)
+int(14)
+string(14) "testing packet"
+string(%d) "%s"
+int(14)
+1> initial packet
+leaving group
+bool(true)
+int(20)
+int(14)
+2> unicast packet
+re-joining group
+bool(true)
+int(12)
+3> mcast packet
---TEST--\r
-Multicast support: IPv6 send options\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('sockets')) {\r
- die('skip sockets extension not available.');\r
-}\r
-if (!defined('IPPROTO_IPV6')) {\r
- die('skip IPv6 not available.');\r
-}\r
-$level = IPPROTO_IPV6;\r
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket");\r
-if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) {\r
- die("skip interface 1 either doesn't exist or has no ipv6 address");\r
-}\r
---FILE--\r
-<?php\r
-$domain = AF_INET6;\r
-$level = IPPROTO_IPV6;\r
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");\r
-\r
-echo "Setting IPV6_MULTICAST_TTL\n";\r
-$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);\r
-var_dump($r);\r
-$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);\r
-var_dump($r);\r
-echo "\n";\r
-\r
-echo "Setting IPV6_MULTICAST_LOOP\n";\r
-$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);\r
-var_dump($r);\r
-$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);\r
-var_dump($r);\r
-$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);\r
-var_dump($r);\r
-$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);\r
-var_dump($r);\r
-echo "\n";\r
-\r
-echo "Setting IPV6_MULTICAST_IF\n";\r
-echo "interface 0:\n";\r
-$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);\r
-var_dump($r);\r
-$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);\r
-var_dump($r);\r
-echo "interface 1:\n";\r
-$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);\r
-var_dump($r);\r
-$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);\r
-var_dump($r);\r
-echo "\n";\r
-\r
---EXPECT--\r
-Setting IPV6_MULTICAST_TTL\r
-bool(true)\r
-int(9)\r
-\r
-Setting IPV6_MULTICAST_LOOP\r
-bool(true)\r
-int(0)\r
-bool(true)\r
-int(1)\r
-\r
-Setting IPV6_MULTICAST_IF\r
-interface 0:\r
-bool(true)\r
-int(0)\r
-interface 1:\r
-bool(true)\r
-int(1)\r
+--TEST--
+Multicast support: IPv6 send options
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) {
+ die('skip sockets extension not available.');
+}
+if (!defined('IPPROTO_IPV6')) {
+ die('skip IPv6 not available.');
+}
+$level = IPPROTO_IPV6;
+$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket");
+if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) {
+ die("skip interface 1 either doesn't exist or has no ipv6 address");
+}
+--FILE--
+<?php
+$domain = AF_INET6;
+$level = IPPROTO_IPV6;
+$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
+
+echo "Setting IPV6_MULTICAST_TTL\n";
+$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);
+var_dump($r);
+$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);
+var_dump($r);
+echo "\n";
+
+echo "Setting IPV6_MULTICAST_LOOP\n";
+$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);
+var_dump($r);
+$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
+var_dump($r);
+$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);
+var_dump($r);
+$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
+var_dump($r);
+echo "\n";
+
+echo "Setting IPV6_MULTICAST_IF\n";
+echo "interface 0:\n";
+$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);
+var_dump($r);
+$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
+var_dump($r);
+echo "interface 1:\n";
+$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);
+var_dump($r);
+$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
+var_dump($r);
+echo "\n";
+
+--EXPECT--
+Setting IPV6_MULTICAST_TTL
+bool(true)
+int(9)
+
+Setting IPV6_MULTICAST_LOOP
+bool(true)
+int(0)
+bool(true)
+int(1)
+
+Setting IPV6_MULTICAST_IF
+interface 0:
+bool(true)
+int(0)
+interface 1:
+bool(true)
+int(1)
---TEST--\r
-SPL: Spl Directory Iterator test getInode\r
---CREDITS--\r
+--TEST--
+SPL: Spl Directory Iterator test getInode
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#Test Fest Cesena (Italy) on 2009-06-20\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");\r
-?>\r
---FILE--\r
-<?php\r
+#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
//file
mkdir('test_dir_ptfi');
--CLEAN--
<?php
rmdir('test_dir_ptfi');
-?>\r
---EXPECTF--\r
+?>
+--EXPECTF--
string(%d) "%d"
---TEST--\r
-SPL: Spl File Info test getInode\r
---CREDITS--\r
+--TEST--
+SPL: Spl File Info test getInode
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#Test Fest Cesena (Italy) on 2009-06-20\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");\r
-?>\r
---FILE--\r
-<?php\r
+#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
//file
$fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getInode());
?>
-\r
+
--EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for %s in %s
Stack trace:
---TEST--\r
-SPL: Spl File Info test getGroup\r
---CREDITS--\r
+--TEST--
+SPL: Spl File Info test getGroup
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#Test Fest Cesena (Italy) on 2009-06-20\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");\r
-?>\r
---FILE--\r
-<?php\r
+#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
//file
$fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getGroup());
?>
-\r
+
--EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getGroup(): stat failed for not_existing in %s
Stack trace:
---TEST--\r
-SPL: Spl File Info test getInode\r
---CREDITS--\r
+--TEST--
+SPL: Spl File Info test getInode
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#Test Fest Cesena (Italy) on 2009-06-20\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");\r
-?>\r
---FILE--\r
-<?php\r
+#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
//file
touch ('SplFileInfo_getInode_basic.txt');
--CLEAN--
<?php
unlink('SplFileInfo_getInode_basic.txt');
-?>\r
---EXPECTF--\r
+?>
+--EXPECTF--
bool(true)
---TEST--\r
-SPL: Spl File Info test getPerms\r
---CREDITS--\r
+--TEST--
+SPL: Spl File Info test getPerms
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#Test Fest Cesena (Italy) on 2009-06-20\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");\r
-?>\r
---FILE--\r
-<?php\r
+#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
//file
$fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getInode());
?>
-\r
+
--EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for not_existing in %s
Stack trace:
---TEST--\r
-SPL: Spl File Info test getOwner\r
---CREDITS--\r
+--TEST--
+SPL: Spl File Info test getOwner
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#Test Fest Cesena (Italy) on 2009-06-20\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");\r
-?>\r
---FILE--\r
-<?php\r
+#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
//file
$fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getOwner());
?>
-\r
+
--EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getOwner(): stat failed for not_existing in %s
Stack trace:
---TEST--\r
-SPL: Spl File Info test getPerms\r
---CREDITS--\r
+--TEST--
+SPL: Spl File Info test getPerms
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#Test Fest Cesena (Italy) on 2009-06-20\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");\r
-?>\r
---FILE--\r
-<?php\r
+#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
//file
touch ('SplFileInfo_getPerms_basic.txt');
--CLEAN--
<?php
unlink('SplFileInfo_getPerms_basic.txt');
-?>\r
---EXPECTF--\r
+?>
+--EXPECTF--
bool(true)
---TEST--\r
-SPL: Spl File Info test getPerms\r
---CREDITS--\r
+--TEST--
+SPL: Spl File Info test getPerms
+--CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it>
-#Test Fest Cesena (Italy) on 2009-06-20\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");\r
-?>\r
---FILE--\r
-<?php\r
+#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
//file
$fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getPerms() == 0100557);
?>
-\r
+
--EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getPerms(): stat failed for %s in %s
Stack trace:
---TEST--\r
-Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)\r
---FILE--\r
-<?php\r
-$q = new SplQueue();\r
-try {\r
- $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);\r
-} catch (Exception $e) {\r
- echo 'unexpected exception: ' . $e->getMessage() . "\n";\r
-}\r
-try {\r
- $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);\r
-} catch (Exception $e) {\r
- echo 'expected exception: ' . $e->getMessage() . "\n";\r
-}\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen\r
-===DONE===\r
+--TEST--
+Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
+--FILE--
+<?php
+$q = new SplQueue();
+try {
+ $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
+} catch (Exception $e) {
+ echo 'unexpected exception: ' . $e->getMessage() . "\n";
+}
+try {
+ $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+} catch (Exception $e) {
+ echo 'expected exception: ' . $e->getMessage() . "\n";
+}
+?>
+===DONE===
+--EXPECTF--
+expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
+===DONE===
---TEST--\r
-Bug #74478: null coalescing operator failing with SplFixedArray\r
---FILE--\r
-<?php\r
-\r
-class MyFixedArray extends \SplFixedArray\r
-{\r
- public function offsetExists($name) {\r
- echo "offsetExists($name)\n";\r
- return parent::offsetExists($name);\r
- }\r
- public function offsetGet($name) {\r
- echo "offsetGet($name)\n";\r
- return parent::offsetGet($name);\r
- }\r
- public function offsetSet($name, $value) {\r
- echo "offsetSet($name)\n";\r
- return parent::offsetSet($name, $value);\r
- }\r
- public function offsetUnset($name) {\r
- echo "offsetUnset($name)\n";\r
- return parent::offsetUnset($name);\r
- }\r
-\r
-};\r
-\r
-$fixedData = new MyFixedArray(10);\r
-var_dump(isset($fixedData[0][1][2]));\r
-var_dump(isset($fixedData[0]->foo));\r
-var_dump($fixedData[0] ?? 42);\r
-var_dump($fixedData[0][1][2] ?? 42);\r
-\r
-$fixedData[0] = new MyFixedArray(10);\r
-$fixedData[0][1] = new MyFixedArray(10);\r
-var_dump(isset($fixedData[0][1][2]));\r
-var_dump($fixedData[0][1][2] ?? 42);\r
-\r
-?>\r
---EXPECT--\r
-offsetExists(0)\r
-bool(false)\r
-offsetExists(0)\r
-bool(false)\r
-offsetExists(0)\r
-int(42)\r
-offsetExists(0)\r
-int(42)\r
-offsetSet(0)\r
-offsetGet(0)\r
-offsetSet(1)\r
-offsetExists(0)\r
-offsetGet(0)\r
-offsetExists(1)\r
-offsetGet(1)\r
-offsetExists(2)\r
-bool(false)\r
-offsetExists(0)\r
-offsetGet(0)\r
-offsetExists(1)\r
-offsetGet(1)\r
-offsetExists(2)\r
+--TEST--
+Bug #74478: null coalescing operator failing with SplFixedArray
+--FILE--
+<?php
+
+class MyFixedArray extends \SplFixedArray
+{
+ public function offsetExists($name) {
+ echo "offsetExists($name)\n";
+ return parent::offsetExists($name);
+ }
+ public function offsetGet($name) {
+ echo "offsetGet($name)\n";
+ return parent::offsetGet($name);
+ }
+ public function offsetSet($name, $value) {
+ echo "offsetSet($name)\n";
+ return parent::offsetSet($name, $value);
+ }
+ public function offsetUnset($name) {
+ echo "offsetUnset($name)\n";
+ return parent::offsetUnset($name);
+ }
+
+};
+
+$fixedData = new MyFixedArray(10);
+var_dump(isset($fixedData[0][1][2]));
+var_dump(isset($fixedData[0]->foo));
+var_dump($fixedData[0] ?? 42);
+var_dump($fixedData[0][1][2] ?? 42);
+
+$fixedData[0] = new MyFixedArray(10);
+$fixedData[0][1] = new MyFixedArray(10);
+var_dump(isset($fixedData[0][1][2]));
+var_dump($fixedData[0][1][2] ?? 42);
+
+?>
+--EXPECT--
+offsetExists(0)
+bool(false)
+offsetExists(0)
+bool(false)
+offsetExists(0)
+int(42)
+offsetExists(0)
+int(42)
+offsetSet(0)
+offsetGet(0)
+offsetSet(1)
+offsetExists(0)
+offsetGet(0)
+offsetExists(1)
+offsetGet(1)
+offsetExists(2)
+bool(false)
+offsetExists(0)
+offsetGet(0)
+offsetExists(1)
+offsetGet(1)
+offsetExists(2)
int(42)
\ No newline at end of file
---TEST--\r
-SPL: RecursiveIteratorIterator cannot be used with foreach by reference\r
---FILE--\r
-<?php \r
-\r
-$arr = array(array(1,2));\r
-$arrOb = new ArrayObject($arr);\r
-\r
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());\r
-\r
-$recItIt = new RecursiveIteratorIterator($recArrIt);\r
-\r
-foreach ($recItIt as &$val) echo "$val\n";\r
-\r
-?>\r
---EXPECTF--\r
-Fatal error: An iterator cannot be used with foreach by reference in %s on line %d\r
+--TEST--
+SPL: RecursiveIteratorIterator cannot be used with foreach by reference
+--FILE--
+<?php
+
+$arr = array(array(1,2));
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+$recItIt = new RecursiveIteratorIterator($recArrIt);
+
+foreach ($recItIt as &$val) echo "$val\n";
+
+?>
+--EXPECTF--
+Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
---TEST--\r
-SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.\r
---FILE--\r
-<?php\r
-\r
-$array = array();\r
-$recArrIt = new RecursiveArrayIterator($array);\r
-\r
-$recItIt = new RecursiveIteratorIterator($recArrIt);\r
-\r
-var_dump($recItIt->beginIteration());\r
-var_dump($recItIt->endIteration());\r
-var_dump($recItIt->nextElement());\r
-\r
-?>\r
-\r
---EXPECTF--\r
-NULL\r
-NULL\r
+--TEST--
+SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
+--FILE--
+<?php
+
+$array = array();
+$recArrIt = new RecursiveArrayIterator($array);
+
+$recItIt = new RecursiveIteratorIterator($recArrIt);
+
+var_dump($recItIt->beginIteration());
+var_dump($recItIt->endIteration());
+var_dump($recItIt->nextElement());
+
+?>
+
+--EXPECTF--
+NULL
+NULL
NULL
\ No newline at end of file
---TEST--\r
-SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST\r
---FILE--\r
-<?php \r
-\r
-$arr = array(array(1,2),2);\r
-$arrOb = new ArrayObject($arr);\r
-\r
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());\r
-\r
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {\r
- \r
- function nextelement() {\r
- echo __METHOD__."\n";\r
- }\r
-}\r
-\r
-\r
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);\r
-\r
-foreach ($recItIt as $key => $val) echo "$key\n";\r
-\r
-?>\r
---EXPECTF--\r
-MyRecursiveIteratorIterator::nextelement\r
-0\r
-MyRecursiveIteratorIterator::nextelement\r
-1\r
-MyRecursiveIteratorIterator::nextelement\r
-0\r
-MyRecursiveIteratorIterator::nextelement\r
+--TEST--
+SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
+--FILE--
+<?php
+
+$arr = array(array(1,2),2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function nextelement() {
+ echo __METHOD__."\n";
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
+
+foreach ($recItIt as $key => $val) echo "$key\n";
+
+?>
+--EXPECTF--
+MyRecursiveIteratorIterator::nextelement
+0
+MyRecursiveIteratorIterator::nextelement
+1
+MyRecursiveIteratorIterator::nextelement
+0
+MyRecursiveIteratorIterator::nextelement
1
\ No newline at end of file
---TEST--\r
-SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()\r
---FILE--\r
-<?php \r
-\r
-$arr = array(array(1,2),2);\r
-$arrOb = new ArrayObject($arr);\r
-\r
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());\r
-\r
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {\r
- \r
- function beginchildren() {\r
- throw new Exception;\r
- }\r
-}\r
-\r
-\r
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);\r
-\r
-var_dump($recItIt->next());\r
-\r
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);\r
-\r
-var_dump($recItIt2->next());\r
-\r
-?>\r
---EXPECTF--\r
-NULL\r
-\r
-Fatal error: Uncaught Exception in %s\r
-Stack trace:\r
-#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()\r
-#1 %s: RecursiveIteratorIterator->next()\r
-#2 {main}\r
- thrown in %s on line %d\r
+--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(array(1,2),2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function beginchildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt2->next());
+
+?>
+--EXPECTF--
+NULL
+
+Fatal error: Uncaught Exception in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d
---TEST--\r
-SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()\r
---FILE--\r
-<?php \r
-\r
-$arr = array(1,2);\r
-$arrOb = new ArrayObject($arr);\r
-\r
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());\r
-\r
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {\r
- \r
- function callHasChildren() {\r
- throw new Exception;\r
- }\r
-}\r
-\r
-\r
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);\r
-\r
-var_dump($recItIt->next());\r
-\r
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);\r
-\r
-var_dump($recItIt2->next());\r
-\r
-?>\r
---EXPECTF--\r
-NULL\r
-\r
-Fatal error: Uncaught Exception in %s\r
-Stack trace:\r
-#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()\r
-#1 %s: RecursiveIteratorIterator->next()\r
-#2 {main}\r
- thrown in %s on line %d\r
+--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(1,2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function callHasChildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt2->next());
+
+?>
+--EXPECTF--
+NULL
+
+Fatal error: Uncaught Exception in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d
---TEST--\r
-SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()\r
---FILE--\r
-<?php \r
-\r
-$arr = array(array(1,2));\r
-$arrOb = new ArrayObject($arr);\r
-\r
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());\r
-\r
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {\r
- \r
- function endchildren() {\r
- throw new Exception;\r
- }\r
-}\r
-\r
-\r
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);\r
-\r
-foreach ($recItIt as $val) echo "$val\n";\r
-\r
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);\r
-\r
-echo "===NEXT LOOP===\n";\r
-\r
-foreach ($recItIt2 as $val) echo "$val\n";\r
-\r
-?>\r
---EXPECTF--\r
-1\r
-2\r
-===NEXT LOOP===\r
-1\r
-2\r
-\r
-Fatal error: Uncaught Exception in %s\r
-Stack trace:\r
-#0 [internal function]: MyRecursiveIteratorIterator->endchildren()\r
-#1 %s: RecursiveIteratorIterator->next()\r
-#2 {main}\r
- thrown in %s on line %d\r
+--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(array(1,2));
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function endchildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+foreach ($recItIt as $val) echo "$val\n";
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+echo "===NEXT LOOP===\n";
+
+foreach ($recItIt2 as $val) echo "$val\n";
+
+?>
+--EXPECTF--
+1
+2
+===NEXT LOOP===
+1
+2
+
+Fatal error: Uncaught Exception in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d
---TEST--\r
-SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()\r
---FILE--\r
-<?php \r
-\r
-$arr = array(1,2);\r
-$arrOb = new ArrayObject($arr);\r
-\r
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());\r
-\r
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {\r
- \r
- function nextelement() {\r
- throw new Exception;\r
- }\r
-}\r
-\r
-\r
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);\r
-\r
-var_dump($recItIt->next());\r
-\r
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);\r
-\r
-var_dump($recItIt->next());\r
-\r
-?>\r
---EXPECTF--\r
-NULL\r
-\r
-Fatal error: Uncaught Exception in %s\r
-Stack trace:\r
-#0 [internal function]: MyRecursiveIteratorIterator->nextelement()\r
-#1 %s: RecursiveIteratorIterator->next()\r
-#2 {main}\r
- thrown in %s on line %d\r
+--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(1,2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function nextelement() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt->next());
+
+?>
+--EXPECTF--
+NULL
+
+Fatal error: Uncaught Exception in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d
---TEST--\r
-Bug #73333 (2147483647 is fetched as string)\r
---SKIPIF--\r
-<?php\r
-if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');\r
-?>\r
---FILE--\r
-<?php\r
-if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);\r
-\r
-$db = new SQLite3(':memory:');\r
-$db->exec('CREATE TABLE foo (bar INT)');\r
-foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {\r
- $db->exec("INSERT INTO foo VALUES ($value)");\r
-}\r
-\r
-$res = $db->query('SELECT bar FROM foo');\r
-while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {\r
- echo gettype($row[0]), PHP_EOL;\r
-}\r
-?>\r
-===DONE===\r
---EXPECT--\r
-integer\r
-integer\r
-===DONE===\r
+--TEST--
+Bug #73333 (2147483647 is fetched as string)
+--SKIPIF--
+<?php
+if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
+?>
+--FILE--
+<?php
+if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
+
+$db = new SQLite3(':memory:');
+$db->exec('CREATE TABLE foo (bar INT)');
+foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
+ $db->exec("INSERT INTO foo VALUES ($value)");
+}
+
+$res = $db->query('SELECT bar FROM foo');
+while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
+ echo gettype($row[0]), PHP_EOL;
+}
+?>
+===DONE===
+--EXPECT--
+integer
+integer
+===DONE===
---TEST--\r
-Bug #43353 wrong detection of 'data' wrapper\r
---SKIPIF--\r
-<?php\r
-if(substr(PHP_OS, 0, 3) != "WIN")\r
- die("skip Run only on Windows");\r
-?>\r
---INI--\r
-allow_url_fopen=1\r
---FILE--\r
-<?php\r
-\r
-var_dump(is_dir('file:///datafoo:test'));\r
-var_dump(is_dir('datafoo:test'));\r
-var_dump(file_get_contents('data:text/plain,foo'));\r
-var_dump(file_get_contents('datafoo:text/plain,foo'));\r
-\r
-?>\r
---EXPECTF--\r
-bool(false)\r
-bool(false)\r
-string(3) "foo"\r
-\r
-Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s\r
-bool(false)\r
+--TEST--
+Bug #43353 wrong detection of 'data' wrapper
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+?>
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+var_dump(is_dir('file:///datafoo:test'));
+var_dump(is_dir('datafoo:test'));
+var_dump(file_get_contents('data:text/plain,foo'));
+var_dump(file_get_contents('datafoo:text/plain,foo'));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+string(3) "foo"
+
+Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
+bool(false)
---TEST--\r
-Test fopen() function : variation: interesting paths, no use include path\r
---FILE--\r
-<?php\r
-// fopen with interesting windows paths.\r
-$testdir = __DIR__ . '/bug47177.tmpdir';\r
-mkdir($testdir);\r
-$t = time() - 3600;\r
-touch($testdir, $t);\r
-clearstatcache();\r
-$t2 = filemtime($testdir);\r
-if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";\r
-rmdir($testdir);\r
-echo "Ok.";\r
-?>\r
---EXPECTF--\r
-Ok.\r
+--TEST--
+Test fopen() function : variation: interesting paths, no use include path
+--FILE--
+<?php
+// fopen with interesting windows paths.
+$testdir = __DIR__ . '/bug47177.tmpdir';
+mkdir($testdir);
+$t = time() - 3600;
+touch($testdir, $t);
+clearstatcache();
+$t2 = filemtime($testdir);
+if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
+rmdir($testdir);
+echo "Ok.";
+?>
+--EXPECTF--
+Ok.
---TEST--\r
-Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)\r
---SKIPIF--\r
-<?php\r
-/* unfortunately no standard function does a cast to FILE*, so we need\r
- * curl to test this */\r
-if (!extension_loaded("curl")) exit("skip curl extension not loaded");\r
---FILE--\r
-<?php\r
-$fn = __DIR__ . "/test.tmp";\r
-@unlink($fn);\r
-$fh = fopen($fn, 'xb');\r
-$ch = curl_init('http://www.yahoo.com/');\r
-var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));\r
-echo "Done.\n";\r
---CLEAN--\r
-<?php\r
-$fn = __DIR__ . "/test.tmp";\r
-@unlink($fn);\r
-?>\r
---EXPECT--\r
-bool(true)\r
-Done.\r
+--TEST--
+Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
+--SKIPIF--
+<?php
+/* unfortunately no standard function does a cast to FILE*, so we need
+ * curl to test this */
+if (!extension_loaded("curl")) exit("skip curl extension not loaded");
+--FILE--
+<?php
+$fn = __DIR__ . "/test.tmp";
+@unlink($fn);
+$fh = fopen($fn, 'xb');
+$ch = curl_init('http://www.yahoo.com/');
+var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
+echo "Done.\n";
+--CLEAN--
+<?php
+$fn = __DIR__ . "/test.tmp";
+@unlink($fn);
+?>
+--EXPECT--
+bool(true)
+Done.
---TEST--\r
-Bug #55124 (recursive mkdir fails with current (dot) directory in path)\r
---FILE--\r
-<?php\r
-$old_dir_path = getcwd();\r
-chdir(__DIR__);\r
-mkdir('a/./b', 0755, true);\r
-if (is_dir('a/b')) {\r
- rmdir('a/b');\r
-}\r
-if (is_dir('./a')) {\r
- rmdir('a');\r
-}\r
-chdir($old_dir_path);\r
-echo "OK";\r
-?>\r
---EXPECT--\r
-OK\r
+--TEST--
+Bug #55124 (recursive mkdir fails with current (dot) directory in path)
+--FILE--
+<?php
+$old_dir_path = getcwd();
+chdir(__DIR__);
+mkdir('a/./b', 0755, true);
+if (is_dir('a/b')) {
+ rmdir('a/b');
+}
+if (is_dir('./a')) {
+ rmdir('a');
+}
+chdir($old_dir_path);
+echo "OK";
+?>
+--EXPECT--
+OK
---TEST--\r
-Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048)\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) != 'WIN') {\r
- die('skip only for Windows');\r
-}\r
-$php = getenv('TEST_PHP_EXECUTABLE');\r
-if (!$php) {\r
- die("No php executable defined\n");\r
-}\r
-?>\r
---FILE--\r
-<?php\r
-\r
-error_reporting(E_ALL);\r
-\r
-$php = getenv('TEST_PHP_EXECUTABLE');\r
-if (!$php) {\r
- die("No php executable defined\n");\r
-}\r
-$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';\r
-$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));\r
-$stdin = str_repeat('*', 1024 * 16) . '!';\r
-$stdin = str_repeat('*', 2049 );\r
-\r
-$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));\r
-$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);\r
-\r
-foreach ($pipes as $pipe) {\r
- stream_set_blocking($pipe, false);\r
-}\r
-$writePipes = array($pipes[0]);\r
-$stdinLen = strlen($stdin);\r
-$stdinOffset = 0;\r
-\r
-unset($pipes[0]);\r
-\r
-while ($pipes || $writePipes) {\r
- $r = $pipes;\r
- $w = $writePipes;\r
- $e = null;\r
- $n = stream_select($r, $w, $e, 60);\r
-\r
- if (false === $n) {\r
- break;\r
- } elseif ($n === 0) {\r
- proc_terminate($process);\r
-\r
- }\r
- if ($w) {\r
- $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);\r
- if (false !== $written) {\r
- $stdinOffset += $written;\r
- }\r
- if ($stdinOffset >= $stdinLen) {\r
- fclose($writePipes[0]);\r
- $writePipes = null;\r
- }\r
- }\r
-\r
- foreach ($r as $pipe) {\r
- $type = array_search($pipe, $pipes);\r
- $data = fread($pipe, 8192);\r
- if (false === $data || feof($pipe)) {\r
- fclose($pipe);\r
- unset($pipes[$type]);\r
- }\r
- }\r
-}\r
-echo "OK.";\r
-?>\r
---EXPECT--\r
-OK.\r
+--TEST--
+Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
+$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
+$stdin = str_repeat('*', 1024 * 16) . '!';
+$stdin = str_repeat('*', 2049 );
+
+$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
+$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
+
+foreach ($pipes as $pipe) {
+ stream_set_blocking($pipe, false);
+}
+$writePipes = array($pipes[0]);
+$stdinLen = strlen($stdin);
+$stdinOffset = 0;
+
+unset($pipes[0]);
+
+while ($pipes || $writePipes) {
+ $r = $pipes;
+ $w = $writePipes;
+ $e = null;
+ $n = stream_select($r, $w, $e, 60);
+
+ if (false === $n) {
+ break;
+ } elseif ($n === 0) {
+ proc_terminate($process);
+
+ }
+ if ($w) {
+ $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
+ if (false !== $written) {
+ $stdinOffset += $written;
+ }
+ if ($stdinOffset >= $stdinLen) {
+ fclose($writePipes[0]);
+ $writePipes = null;
+ }
+ }
+
+ foreach ($r as $pipe) {
+ $type = array_search($pipe, $pipes);
+ $data = fread($pipe, 8192);
+ if (false === $data || feof($pipe)) {
+ fclose($pipe);
+ unset($pipes[$type]);
+ }
+ }
+}
+echo "OK.";
+?>
+--EXPECT--
+OK.
---TEST--\r
-Test rename() function: variation\r
---SKIPIF--\r
-<?php\r
-if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');\r
-?>\r
---FILE--\r
-<?php\r
-/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );\r
- Description: Renames a file or directory\r
-*/\r
-\r
-echo "\n*** Testing rename() on non-existing file ***\n";\r
-$file_path = dirname(__FILE__);\r
-\r
-// try renaming a non existing file\r
-$src_name = $file_path."/non_existent_file.tmp";\r
-$dest_name = $file_path."/rename_variation8_new.tmp";\r
-var_dump( rename($src_name, $dest_name) );\r
-\r
-// ensure that $dest_name didn't get created\r
-var_dump( file_exists($src_name) ); // expecting false\r
-var_dump( file_exists($dest_name) ); // expecting false\r
-\r
-// rename a existing dir to new name\r
-echo "\n*** Testing rename() on existing directory ***\n";\r
-$dir_name = $file_path."/rename_basic_dir";\r
-mkdir($dir_name);\r
-$new_dir_name = $file_path."/rename_basic_dir1";\r
-var_dump( rename($dir_name, $new_dir_name) );\r
-//ensure that $new_dir_name got created\r
-var_dump( file_exists($dir_name) ); // expecting false\r
-var_dump( file_exists($new_dir_name) ); // expecting true\r
-\r
-// try to rename an non_existing dir \r
-echo "\n*** Testing rename() on non-existing directory ***\n";\r
-$non_existent_dir_name = $file_path."/non_existent_dir";\r
-$new_dir_name = "$file_path/rename_basic_dir2";\r
-var_dump( rename($non_existent_dir_name, $new_dir_name) );\r
-// ensure that $new_dir_name didn't get created\r
-var_dump( file_exists($non_existent_dir_name) ); // expecting flase\r
-var_dump( file_exists($new_dir_name) ); // expecting false\r
-\r
-echo "Done\n";\r
-?>\r
---CLEAN--\r
-<?php\r
-rmdir(dirname(__FILE__)."/rename_basic_dir1");\r
-?>\r
---EXPECTF--\r
-*** Testing rename() on non-existing file ***\r
-\r
-Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d\r
-bool(false)\r
-bool(false)\r
-bool(false)\r
-\r
-*** Testing rename() on existing directory ***\r
-bool(true)\r
-bool(false)\r
-bool(true)\r
-\r
-*** Testing rename() on non-existing directory ***\r
-\r
-Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d\r
-bool(false)\r
-bool(false)\r
-bool(false)\r
-Done\r
-\r
+--TEST--
+Test rename() function: variation
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "\n*** Testing rename() on non-existing file ***\n";
+$file_path = dirname(__FILE__);
+
+// try renaming a non existing file
+$src_name = $file_path."/non_existent_file.tmp";
+$dest_name = $file_path."/rename_variation8_new.tmp";
+var_dump( rename($src_name, $dest_name) );
+
+// ensure that $dest_name didn't get created
+var_dump( file_exists($src_name) ); // expecting false
+var_dump( file_exists($dest_name) ); // expecting false
+
+// rename a existing dir to new name
+echo "\n*** Testing rename() on existing directory ***\n";
+$dir_name = $file_path."/rename_basic_dir";
+mkdir($dir_name);
+$new_dir_name = $file_path."/rename_basic_dir1";
+var_dump( rename($dir_name, $new_dir_name) );
+//ensure that $new_dir_name got created
+var_dump( file_exists($dir_name) ); // expecting false
+var_dump( file_exists($new_dir_name) ); // expecting true
+
+// try to rename an non_existing dir
+echo "\n*** Testing rename() on non-existing directory ***\n";
+$non_existent_dir_name = $file_path."/non_existent_dir";
+$new_dir_name = "$file_path/rename_basic_dir2";
+var_dump( rename($non_existent_dir_name, $new_dir_name) );
+// ensure that $new_dir_name didn't get created
+var_dump( file_exists($non_existent_dir_name) ); // expecting flase
+var_dump( file_exists($new_dir_name) ); // expecting false
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/rename_basic_dir1");
+?>
+--EXPECTF--
+*** Testing rename() on non-existing file ***
+
+Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing rename() on existing directory ***
+bool(true)
+bool(false)
+bool(true)
+
+*** Testing rename() on non-existing directory ***
+
+Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+Done
+
---TEST--\r
-Unexposed/leaked stream encloses another stream\r
---SKIPIF--\r
-<?php\r
-if (!function_exists('leak_variable')) die("skip only debug builds");\r
---FILE--\r
-<?php\r
-$s = fopen('php://temp/maxmemory=1024','wb+');\r
-\r
-$t = fopen('php://temp/maxmemory=1024','wb+');\r
-\r
-/* force conversion of inner stream to STDIO. */\r
-$i = 0;\r
-while ($i++ < 5000) {\r
- fwrite($t, str_repeat('a',1024));\r
-}\r
-\r
-leak_variable($s, true);\r
-leak_variable($t, true);\r
---EXPECT--\r
+--TEST--
+Unexposed/leaked stream encloses another stream
+--SKIPIF--
+<?php
+if (!function_exists('leak_variable')) die("skip only debug builds");
+--FILE--
+<?php
+$s = fopen('php://temp/maxmemory=1024','wb+');
+
+$t = fopen('php://temp/maxmemory=1024','wb+');
+
+/* force conversion of inner stream to STDIO. */
+$i = 0;
+while ($i++ < 5000) {
+ fwrite($t, str_repeat('a',1024));
+}
+
+leak_variable($s, true);
+leak_variable($t, true);
+--EXPECT--
---TEST--\r
-Bug#48746 - Junction not working properly\r
-\r
---CREDITS--\r
-Venkat Raman Don (don.raman@microsoft.com)\r
-\r
---SKIPIF--\r
-<?php\r
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
- die('skip windows only test');\r
-}\r
-include_once __DIR__ . '/common.inc';\r
-$cmd = "mklink /?";\r
-$ret = @exec($cmd, $output, $return_val);\r
-if (count($output) == 0) {\r
- die("mklink.exe not found in PATH");\r
-}\r
-?>\r
---FILE--\r
-<?php\r
-include_once __DIR__ . '/common.inc';\r
-$mountvol = get_mountvol();\r
-$old_dir = __DIR__;\r
-$dirname = __DIR__ . "\\mnt\\test\\directory";\r
-mkdir($dirname, 0700, true);\r
-chdir(__DIR__ . "\\mnt\\test");\r
-$drive = substr(__DIR__, 0, 2);\r
-$pathwithoutdrive = substr(__DIR__, 2);\r
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);\r
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);\r
-$fullpath = "mounted_volume" . $pathwithoutdrive;\r
-exec("mklink /j mklink_junction directory", $output, $ret_val);\r
-var_dump(file_exists("directory"));\r
-var_dump(file_exists("mklink_junction"));\r
-var_dump(file_exists("mounted_volume"));\r
-var_dump(file_exists("$fullpath"));\r
-var_dump(is_dir("mklink_junction"));\r
-var_dump(is_dir("$fullpath"));\r
-var_dump(is_readable("mklink_junction"));\r
-var_dump(is_writeable("$fullpath"));\r
-chdir($old_dir);\r
-\r
-rmdir(__DIR__ . "\\mnt\\test\\directory");\r
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");\r
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");\r
-rmdir(__DIR__ . "\\mnt\\test");\r
-rmdir(__DIR__ . "\\mnt");\r
-\r
-?>\r
---EXPECT--\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$cmd = "mklink /?";
+$ret = @exec($cmd, $output, $return_val);
+if (count($output) == 0) {
+ die("mklink.exe not found in PATH");
+}
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+mkdir($dirname, 0700, true);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+var_dump(file_exists("directory"));
+var_dump(file_exists("mklink_junction"));
+var_dump(file_exists("mounted_volume"));
+var_dump(file_exists("$fullpath"));
+var_dump(is_dir("mklink_junction"));
+var_dump(is_dir("$fullpath"));
+var_dump(is_readable("mklink_junction"));
+var_dump(is_writeable("$fullpath"));
+chdir($old_dir);
+
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
---TEST--\r
-Bug#48746 - Junction not working properly\r
-\r
---CREDITS--\r
-Venkat Raman Don (don.raman@microsoft.com)\r
-\r
---SKIPIF--\r
-<?php\r
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
- die('skip windows only test');\r
-}\r
-include_once __DIR__ . '/common.inc';\r
-$cmd = "mklink /?";\r
-$ret = @exec($cmd, $output, $return_val);\r
-if (count($output) == 0) {\r
- die("mklink.exe not found in PATH");\r
-}\r
-?>\r
---FILE--\r
-<?php\r
-include_once __DIR__ . '/common.inc';\r
-$mountvol = get_mountvol();\r
-$old_dir = __DIR__;\r
-$dirname = __DIR__ . "\\mnt\\test\\directory";\r
-exec("mkdir " . $dirname, $output, $ret_val);\r
-chdir(__DIR__ . "\\mnt\\test");\r
-$drive = substr(__DIR__, 0, 2);\r
-$pathwithoutdrive = substr(__DIR__, 2);\r
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);\r
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);\r
-$fullpath = "mounted_volume" . $pathwithoutdrive;\r
-exec("mklink /j mklink_junction directory", $output, $ret_val);\r
-file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");\r
-include_once "mklink_junction\\a.php";\r
-file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");\r
-require "$fullpath\\mnt\\test\\directory\\b.php";\r
-file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "<?php echo \"I am included.\n\" ?>");\r
-require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php";\r
-var_dump(is_file("mklink_junction\\a.php"));\r
-var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php"));\r
-var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php"));\r
-unlink("$fullpath\\mnt\\test\\directory\\b.php");\r
-unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php");\r
-unlink("mklink_junction\\a.php");\r
-chdir($old_dir);\r
-rmdir(__DIR__ . "\\mnt\\test\\directory");\r
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");\r
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");\r
-rmdir(__DIR__ . "\\mnt\\test");\r
-rmdir(__DIR__ . "\\mnt");\r
-\r
-?>\r
---EXPECT--\r
-I am included.\r
-I am included.\r
-I am included.\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$cmd = "mklink /?";
+$ret = @exec($cmd, $output, $return_val);
+if (count($output) == 0) {
+ die("mklink.exe not found in PATH");
+}
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+include_once "mklink_junction\\a.php";
+file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
+require "$fullpath\\mnt\\test\\directory\\b.php";
+file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "<?php echo \"I am included.\n\" ?>");
+require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php";
+var_dump(is_file("mklink_junction\\a.php"));
+var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php"));
+var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php"));
+unlink("$fullpath\\mnt\\test\\directory\\b.php");
+unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php");
+unlink("mklink_junction\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+I am included.
+I am included.
+I am included.
+bool(true)
+bool(true)
+bool(true)
---TEST--\r
-Bug#48746 - Junction not working properly\r
-\r
---CREDITS--\r
-Venkat Raman Don (don.raman@microsoft.com)\r
-\r
---SKIPIF--\r
-<?php\r
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
- die('skip windows only test');\r
-}\r
-include_once __DIR__ . '/common.inc';\r
-$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);\r
-if (strpos($ret, 'privilege')) {\r
- die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');\r
-}\r
-unlink('bug48746_tmp.lnk');\r
-?>\r
---FILE--\r
-<?php\r
-include_once __DIR__ . '/common.inc';\r
-$mountvol = get_mountvol();\r
-$old_dir = __DIR__;\r
-$dirname = __DIR__ . "\\mnt\\test\\directory";\r
-exec("mkdir " . $dirname, $output, $ret_val);\r
-chdir(__DIR__ . "\\mnt\\test");\r
-$drive = substr(__DIR__, 0, 2);\r
-$pathwithoutdrive = substr(__DIR__, 2);\r
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);\r
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);\r
-$fullpath = "mounted_volume" . $pathwithoutdrive;\r
-exec("mklink /j mklink_junction directory", $output, $ret_val);\r
-file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");\r
-file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");\r
-print_r(scandir("mklink_junction"));\r
-print_r(scandir("$fullpath\\mnt\\test\\directory"));\r
-print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));\r
-unlink("$fullpath\\mnt\\test\\directory\\b.php");\r
-unlink("mklink_junction\\a.php");\r
-chdir($old_dir);\r
-rmdir(__DIR__ . "\\mnt\\test\\directory");\r
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");\r
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");\r
-rmdir(__DIR__ . "\\mnt\\test");\r
-rmdir(__DIR__ . "\\mnt");\r
-\r
-?>\r
---EXPECT--\r
-Array\r
-(\r
- [0] => .\r
- [1] => ..\r
- [2] => a.php\r
- [3] => b.php\r
-)\r
-Array\r
-(\r
- [0] => .\r
- [1] => ..\r
- [2] => a.php\r
- [3] => b.php\r
-)\r
-Array\r
-(\r
- [0] => .\r
- [1] => ..\r
- [2] => a.php\r
- [3] => b.php\r
-)\r
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
+if (strpos($ret, 'privilege')) {
+ die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
+}
+unlink('bug48746_tmp.lnk');
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
+print_r(scandir("mklink_junction"));
+print_r(scandir("$fullpath\\mnt\\test\\directory"));
+print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));
+unlink("$fullpath\\mnt\\test\\directory\\b.php");
+unlink("mklink_junction\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
---TEST--\r
-Bug#48746 - Junction not working properly\r
-\r
---CREDITS--\r
-Venkat Raman Don (don.raman@microsoft.com)\r
-\r
---SKIPIF--\r
-<?php\r
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
- die('skip windows only test');\r
-}\r
-include_once __DIR__ . '/common.inc';\r
-$ret = exec(get_junction().' /? 2>&1', $out);\r
-if (strpos($out[0], 'recognized')) {\r
- die('skip. junction.exe not found in PATH.');\r
-}\r
-\r
-?>\r
---FILE--\r
-<?php\r
-include_once __DIR__ . '/common.inc';\r
-$old_dir = __DIR__;\r
-$dirname = __DIR__ . "\\mnt\\test\\directory";\r
-exec("mkdir " . $dirname, $output, $ret_val);\r
-chdir(__DIR__ . "\\mnt\\test");\r
-exec(get_junction()." junction directory", $output, $ret_val);\r
-file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");\r
-file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");\r
-include "junction/a.php";\r
-require_once "junction\\b.php";\r
-print_r(scandir("junction"));\r
-unlink("junction\\a.php");\r
-unlink("junction\\b.php");\r
-chdir($old_dir);\r
-rmdir(__DIR__ . "\\mnt\\test\\directory");\r
-rmdir(__DIR__ . "\\mnt\\test\\junction");\r
-rmdir(__DIR__ . "\\mnt\\test");\r
-rmdir(__DIR__ . "\\mnt");\r
-\r
-?>\r
---EXPECT--\r
-I am included.\r
-I am included.\r
-Array\r
-(\r
- [0] => .\r
- [1] => ..\r
- [2] => a.php\r
- [3] => b.php\r
-)\r
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$ret = exec(get_junction().' /? 2>&1', $out);
+if (strpos($out[0], 'recognized')) {
+ die('skip. junction.exe not found in PATH.');
+}
+
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+exec(get_junction()." junction directory", $output, $ret_val);
+file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
+include "junction/a.php";
+require_once "junction\\b.php";
+print_r(scandir("junction"));
+unlink("junction\\a.php");
+unlink("junction\\b.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\junction");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+I am included.
+I am included.
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
---TEST--\r
-Bug #73962 bug with symlink related to cyrillic directory\r
---SKIPIF--\r
-<?php\r
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
- die('skip windows only test');\r
-}\r
-include_once __DIR__ . '/common.inc';\r
-$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);\r
-if (strpos($ret, 'privilege')) {\r
- die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');\r
-}\r
-unlink('bug48746_tmp.lnk');\r
-?>\r
---FILE--\r
-<?php\r
-include_once __DIR__ . '/common.inc';\r
-$mountvol = get_mountvol();\r
-$old_dir = __DIR__;\r
-$dirname = '"' . __DIR__ . "\\mnt\\test\\новая папка" . '"';\r
-exec("mkdir " . $dirname, $output, $ret_val);\r
-chdir(__DIR__ . "\\mnt\\test");\r
-$drive = substr(__DIR__, 0, 2);\r
-$pathwithoutdrive = substr(__DIR__, 2);\r
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);\r
-exec("mklink /d mounted_volume " . $ret, $output, $ret_val);\r
-$fullpath = "mounted_volume" . $pathwithoutdrive;\r
-exec("mklink /d mklink_symlink \"новая папка\"", $output, $ret_val);\r
-file_put_contents("mklink_symlink\\a.php", "<?php echo \"I am included.\n\" ?>");\r
-file_put_contents("$fullpath\\mnt\\test\\новая папка\\b.php", "<?php echo \"I am included.\n\" ?>");\r
-var_dump(scandir("mklink_symlink"));\r
-var_dump(scandir("$fullpath\\mnt\\test\\новая папка"));\r
-var_dump(scandir("$fullpath\\mnt\\test\\mklink_symlink"));\r
-var_dump(is_readable("$fullpath\\mnt\\test\\mklink_symlink\b.php"));\r
-unlink("$fullpath\\mnt\\test\\новая папка\\b.php");\r
-unlink("mklink_symlink\\a.php");\r
-chdir($old_dir);\r
-rmdir(__DIR__ . "\\mnt\\test\\новая папка");\r
-rmdir(__DIR__ . "\\mnt\\test\\mklink_symlink");\r
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");\r
-rmdir(__DIR__ . "\\mnt\\test");\r
-rmdir(__DIR__ . "\\mnt");\r
-\r
-?>\r
---EXPECT--\r
-array(4) {\r
- [0]=>\r
- string(1) "."\r
- [1]=>\r
- string(2) ".."\r
- [2]=>\r
- string(5) "a.php"\r
- [3]=>\r
- string(5) "b.php"\r
-}\r
-array(4) {\r
- [0]=>\r
- string(1) "."\r
- [1]=>\r
- string(2) ".."\r
- [2]=>\r
- string(5) "a.php"\r
- [3]=>\r
- string(5) "b.php"\r
-}\r
-array(4) {\r
- [0]=>\r
- string(1) "."\r
- [1]=>\r
- string(2) ".."\r
- [2]=>\r
- string(5) "a.php"\r
- [3]=>\r
- string(5) "b.php"\r
-}\r
-bool(true)\r
-\r
+--TEST--
+Bug #73962 bug with symlink related to cyrillic directory
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
+if (strpos($ret, 'privilege')) {
+ die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
+}
+unlink('bug48746_tmp.lnk');
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = '"' . __DIR__ . "\\mnt\\test\\новая папка" . '"';
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /d mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /d mklink_symlink \"новая папка\"", $output, $ret_val);
+file_put_contents("mklink_symlink\\a.php", "<?php echo \"I am included.\n\" ?>");
+file_put_contents("$fullpath\\mnt\\test\\новая папка\\b.php", "<?php echo \"I am included.\n\" ?>");
+var_dump(scandir("mklink_symlink"));
+var_dump(scandir("$fullpath\\mnt\\test\\новая папка"));
+var_dump(scandir("$fullpath\\mnt\\test\\mklink_symlink"));
+var_dump(is_readable("$fullpath\\mnt\\test\\mklink_symlink\b.php"));
+unlink("$fullpath\\mnt\\test\\новая папка\\b.php");
+unlink("mklink_symlink\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\новая папка");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_symlink");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(5) "a.php"
+ [3]=>
+ string(5) "b.php"
+}
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(5) "a.php"
+ [3]=>
+ string(5) "b.php"
+}
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(5) "a.php"
+ [3]=>
+ string(5) "b.php"
+}
+bool(true)
+
---TEST--\r
-Bug #23650 (putenv() does not assign values when the value is one character)\r
---FILE--\r
-<?php\r
-putenv("foo=ab");\r
-putenv("bar=c");\r
-var_dump(getenv("foo"));\r
-var_dump(getenv("bar"));\r
-var_dump(getenv("thisvardoesnotexist"));\r
-?>\r
---EXPECT--\r
-string(2) "ab"\r
-string(1) "c"\r
-bool(false)\r
+--TEST--
+Bug #23650 (putenv() does not assign values when the value is one character)
+--FILE--
+<?php
+putenv("foo=ab");
+putenv("bar=c");
+var_dump(getenv("foo"));
+var_dump(getenv("bar"));
+var_dump(getenv("thisvardoesnotexist"));
+?>
+--EXPECT--
+string(2) "ab"
+string(1) "c"
+bool(false)
---TEST--\r
-Test get_defined_constants() function : basic functionality \r
---FILE--\r
-<?php\r
-/* Prototype : array get_defined_constants ([ bool $categorize ] )\r
- * Description: Returns an associative array with the names of all the constants and their values\r
- * Source code: Zend/zend_builtin_functions.c\r
- */ \r
-\r
-echo "*** Testing get_defined_constants() : basic functionality ***\n";\r
-\r
-var_dump(gettype(get_defined_constants(true)));\r
-var_dump(gettype(get_defined_constants()));\r
-\r
-$arr1 = get_defined_constants(false);\r
-$arr2 = get_defined_constants();\r
-var_dump(array_diff($arr1, $arr2));\r
-\r
-$n1 = count(get_defined_constants());\r
-define("USER_CONSTANT", "test");\r
-$arr2 = get_defined_constants();\r
-$n2 = count($arr2);\r
-\r
-if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {\r
- echo "TEST PASSED\n";\r
-} else {\r
- echo "TEST FAILED\n";\r
-}\r
-\r
-?>\r
-===DONE===\r
---EXPECTF-- \r
-*** Testing get_defined_constants() : basic functionality ***\r
-string(5) "array"\r
-string(5) "array"\r
-array(0) {\r
-}\r
-TEST PASSED\r
+--TEST--
+Test get_defined_constants() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array get_defined_constants ([ bool $categorize ] )
+ * Description: Returns an associative array with the names of all the constants and their values
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_defined_constants() : basic functionality ***\n";
+
+var_dump(gettype(get_defined_constants(true)));
+var_dump(gettype(get_defined_constants()));
+
+$arr1 = get_defined_constants(false);
+$arr2 = get_defined_constants();
+var_dump(array_diff($arr1, $arr2));
+
+$n1 = count(get_defined_constants());
+define("USER_CONSTANT", "test");
+$arr2 = get_defined_constants();
+$n2 = count($arr2);
+
+if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_defined_constants() : basic functionality ***
+string(5) "array"
+string(5) "array"
+array(0) {
+}
+TEST PASSED
===DONE===
\ No newline at end of file
---TEST--\r
-Test get_loaded_extensions() function : basic functionality \r
---FILE--\r
-<?php\r
-/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )\r
- * Description: Returns an array with the names of all modules compiled and loaded\r
- * Source code: Zend/zend_builtin_functions.c\r
- */ \r
-\r
-echo "*** Testing get_loaded_extensions() : basic functionality ***\n";\r
-\r
-echo "Get loaded extensions\n";\r
-var_dump(get_loaded_extensions());\r
-\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-*** Testing get_loaded_extensions() : basic functionality ***\r
-Get loaded extensions\r
-array(%d) {\r
-%a\r
-}\r
+--TEST--
+Test get_loaded_extensions() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
+ * Description: Returns an array with the names of all modules compiled and loaded
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_loaded_extensions() : basic functionality ***\n";
+
+echo "Get loaded extensions\n";
+var_dump(get_loaded_extensions());
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_loaded_extensions() : basic functionality ***
+Get loaded extensions
+array(%d) {
+%a
+}
===DONE===
\ No newline at end of file
---TEST--\r
-Test uniqid() function : error conditions\r
---FILE--\r
-<?php\r
-/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )\r
- * Description: Gets a prefixed unique identifier based on the current time in microseconds. \r
- * Source code: ext/standard/uniqid.c\r
-*/\r
-echo "*** Testing uniqid() : error conditions ***\n";\r
-\r
-echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n";\r
-$prefix = null;\r
-$more_entropy = false;\r
-$extra_arg = false;\r
-var_dump(uniqid($prefix, $more_entropy, $extra_arg));\r
-\r
-echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n";\r
-class class1{}\r
-$obj = new class1();\r
-$res = fopen(__FILE__, "r"); \r
-$array = array(1,2,3);\r
-\r
-uniqid($array, false);\r
-uniqid($res, false);\r
-uniqid($obj, false);\r
-\r
-fclose($res);\r
-\r
-?>\r
-===DONE===\r
---EXPECTF-- \r
-*** Testing uniqid() : error conditions ***\r
-\r
--- Testing uniqid() function with more than expected no. of arguments --\r
-\r
-Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d\r
-NULL\r
-\r
--- Testing uniqid() function with invalid values for $prefix --\r
-\r
-Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d\r
-\r
-Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d\r
-\r
-Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d\r
+--TEST--
+Test uniqid() function : error conditions
+--FILE--
+<?php
+/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
+ * Description: Gets a prefixed unique identifier based on the current time in microseconds.
+ * Source code: ext/standard/uniqid.c
+*/
+echo "*** Testing uniqid() : error conditions ***\n";
+
+echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n";
+$prefix = null;
+$more_entropy = false;
+$extra_arg = false;
+var_dump(uniqid($prefix, $more_entropy, $extra_arg));
+
+echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n";
+class class1{}
+$obj = new class1();
+$res = fopen(__FILE__, "r");
+$array = array(1,2,3);
+
+uniqid($array, false);
+uniqid($res, false);
+uniqid($obj, false);
+
+fclose($res);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing uniqid() : error conditions ***
+
+-- Testing uniqid() function with more than expected no. of arguments --
+
+Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing uniqid() function with invalid values for $prefix --
+
+Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d
+
+Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d
+
+Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d
===DONE===
\ No newline at end of file
---TEST--\r
-Bug #73203 (passing additional_parameters causes mail to fail)\r
---DESCRIPTION--\r
-We're not really interested in testing mail() here, but it is currently the\r
-only function besides mb_send_mail() which allows to call php_escape_shell_cmd()\r
-with an empty string. Therefore we don't check the resulting email, but only\r
-verify that the call succeeds.\r
---INI--\r
-sendmail_path=cat >/dev/null\r
-mail.add_x_header = Off\r
---SKIPIF--\r
-<?php \r
-if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows');\r
-?>\r
---FILE--\r
-<?php\r
-var_dump(\r
- mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '')\r
-);\r
-?>\r
-===DONE===\r
---EXPECT--\r
-bool(true)\r
-===DONE===\r
+--TEST--
+Bug #73203 (passing additional_parameters causes mail to fail)
+--DESCRIPTION--
+We're not really interested in testing mail() here, but it is currently the
+only function besides mb_send_mail() which allows to call php_escape_shell_cmd()
+with an empty string. Therefore we don't check the resulting email, but only
+verify that the call succeeds.
+--INI--
+sendmail_path=cat >/dev/null
+mail.add_x_header = Off
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows');
+?>
+--FILE--
+<?php
+var_dump(
+ mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '')
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+===DONE===
---TEST--\r
-Test gethostbyname() function : basic functionality \r
---FILE--\r
-<?php\r
-/* Prototype : string gethostbyname ( string $hostname )\r
- * Description: Get the IPv4 address corresponding to a given Internet host name \r
- * Source code: ext/standard/dns.c\r
-*/\r
-\r
-echo "*** Testing gethostbyname() : basic functionality ***\n";\r
-\r
-echo gethostbyname("localhost")."\n";\r
-?>\r
-===DONE===\r
---EXPECT--\r
-*** Testing gethostbyname() : basic functionality ***\r
-127.0.0.1\r
+--TEST--
+Test gethostbyname() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gethostbyname ( string $hostname )
+ * Description: Get the IPv4 address corresponding to a given Internet host name
+ * Source code: ext/standard/dns.c
+*/
+
+echo "*** Testing gethostbyname() : basic functionality ***\n";
+
+echo gethostbyname("localhost")."\n";
+?>
+===DONE===
+--EXPECT--
+*** Testing gethostbyname() : basic functionality ***
+127.0.0.1
===DONE===
\ No newline at end of file
---TEST--\r
-Test gethostbynamel() function : basic functionality \r
---FILE--\r
-<?php\r
-/* Prototype : array gethostbynamel ( string $hostname )\r
- * Description: Get a list of IPv4 addresses corresponding to a given Internet host name \r
- * Source code: ext/standard/dns.c\r
-*/\r
-\r
-echo "*** Testing gethostbynamel() : basic functionality ***\n";\r
-var_dump(gethostbynamel("localhost"));\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-*** Testing gethostbynamel() : basic functionality ***\r
-array(%d) {\r
- %a\r
-}\r
+--TEST--
+Test gethostbynamel() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array gethostbynamel ( string $hostname )
+ * Description: Get a list of IPv4 addresses corresponding to a given Internet host name
+ * Source code: ext/standard/dns.c
+*/
+
+echo "*** Testing gethostbynamel() : basic functionality ***\n";
+var_dump(gethostbynamel("localhost"));
+?>
+===DONE===
+--EXPECTF--
+*** Testing gethostbynamel() : basic functionality ***
+array(%d) {
+ %a
+}
===DONE===
\ No newline at end of file
---TEST--\r
-Bug #49936 (crash with ftp stream in php_stream_context_get_option())\r
---SKIPIF--\r
-<?php\r
-if( substr(PHP_OS, 0, 3) != "WIN" )\r
- die("skip. Do run on Windows only");\r
-?>\r
---INI--\r
-default_socket_timeout=2\r
---FILE--\r
-<?php\r
-\r
-$dir = 'ftp://your:self@localhost/';\r
-\r
-var_dump(opendir($dir));\r
-var_dump(opendir($dir));\r
-\r
-?>\r
---EXPECTF--\r
-Warning: opendir(): connect() failed: %s\r
- in %s on line %d\r
-\r
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d\r
-bool(false)\r
-\r
-Warning: opendir(): connect() failed: %s\r
- in %s on line %d\r
-\r
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d\r
-bool(false)\r
+--TEST--
+Bug #49936 (crash with ftp stream in php_stream_context_get_option())
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip. Do run on Windows only");
+?>
+--INI--
+default_socket_timeout=2
+--FILE--
+<?php
+
+$dir = 'ftp://your:self@localhost/';
+
+var_dump(opendir($dir));
+var_dump(opendir($dir));
+
+?>
+--EXPECTF--
+Warning: opendir(): connect() failed: %s
+ in %s on line %d
+
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+bool(false)
+
+Warning: opendir(): connect() failed: %s
+ in %s on line %d
+
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+bool(false)
---TEST--\r
-Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows\r
---SKIPIF--\r
-<?php\r
-if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }\r
-if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); }\r
-?>\r
---FILE--\r
-<?php\r
-$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");\r
-$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);\r
-stream_set_blocking($fd, 0);\r
-stream_socket_sendto($fd,$data);\r
-sleep(1);\r
-$ret = stream_get_contents($fd,65565);\r
-var_dump(strlen($ret) > 0);\r
-stream_socket_shutdown($fd,STREAM_SHUT_RDWR);\r
-?>\r
-==DONE==\r
---EXPECTF--\r
-bool(true)\r
-==DONE==\r
+--TEST--
+Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows
+--SKIPIF--
+<?php
+if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
+if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); }
+?>
+--FILE--
+<?php
+$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");
+$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
+stream_set_blocking($fd, 0);
+stream_socket_sendto($fd,$data);
+sleep(1);
+$ret = stream_get_contents($fd,65565);
+var_dump(strlen($ret) > 0);
+stream_socket_shutdown($fd,STREAM_SHUT_RDWR);
+?>
+==DONE==
+--EXPECTF--
+bool(true)
+==DONE==
---TEST--\r
-Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size)\r
---FILE--\r
-<?php\r
-$salt = '$1$f+uslYF01$';\r
-$password = 'test';\r
-echo $salt . "\n";\r
-echo crypt($password,$salt) . "\n";\r
-?>\r
---EXPECT--\r
-$1$f+uslYF01$\r
-$1$f+uslYF0$orVloNmKSLvOeswusE0bY.\r
+--TEST--
+Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size)
+--FILE--
+<?php
+$salt = '$1$f+uslYF01$';
+$password = 'test';
+echo $salt . "\n";
+echo crypt($password,$salt) . "\n";
+?>
+--EXPECT--
+$1$f+uslYF01$
+$1$f+uslYF0$orVloNmKSLvOeswusE0bY.
---TEST--\r
-Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1)\r
---FILE--\r
-<?php\r
-var_dump(unpack("H*",html_entity_decode("é", ENT_QUOTES, "ISO-8859-1")));\r
-echo "double quotes variations:", "\n";\r
-echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n";\r
-echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n";\r
-echo html_entity_decode("""), "\n";\r
-echo html_entity_decode("""), "\n";\r
-\r
-echo "\nsingle quotes variations:", "\n";\r
-echo html_entity_decode("'", ENT_NOQUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode("'", ENT_QUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode("'", ENT_COMPAT, 'UTF-8'), "\n";\r
-echo html_entity_decode("'"), "\n";\r
---EXPECT--\r
-array(1) {\r
- [1]=>\r
- string(2) "e9"\r
-}\r
-double quotes variations:\r
-"\r
-"\r
-"\r
-"\r
-"\r
-"\r
-"\r
-"\r
-\r
-single quotes variations:\r
-'\r
-'\r
-'\r
-'\r
+--TEST--
+Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1)
+--FILE--
+<?php
+var_dump(unpack("H*",html_entity_decode("é", ENT_QUOTES, "ISO-8859-1")));
+echo "double quotes variations:", "\n";
+echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("""), "\n";
+echo html_entity_decode("""), "\n";
+
+echo "\nsingle quotes variations:", "\n";
+echo html_entity_decode("'", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("'", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("'", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("'"), "\n";
+--EXPECT--
+array(1) {
+ [1]=>
+ string(2) "e9"
+}
+double quotes variations:
+"
+"
+"
+"
+"
+"
+"
+"
+
+single quotes variations:
+'
+'
+'
+'
---TEST--\r
-Test get_html_translation_table() function : basic functionality - with default args\r
---FILE--\r
-<?php\r
-/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )\r
- * Description: Returns the internal translation table used by htmlspecialchars and htmlentities\r
- * Source code: ext/standard/html.c\r
-*/\r
-\r
-/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */\r
-\r
-\r
-echo "*** Testing get_html_translation_table() : basic functionality ***\n";\r
-\r
-echo "-- with table = HTML_ENTITIES --\n";\r
-$table = HTML_ENTITIES;\r
-$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");\r
-asort($tt);\r
-var_dump( $tt );\r
-\r
-echo "-- with table = HTML_SPECIALCHARS --\n";\r
-$table = HTML_SPECIALCHARS;\r
-$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");\r
-asort($tt);\r
-var_dump( $tt );\r
-\r
-echo "Done\n";\r
-?>\r
---EXPECT--\r
-*** Testing get_html_translation_table() : basic functionality ***\r
--- with table = HTML_ENTITIES --\r
-array(252) {\r
- ["Æ"]=>\r
- string(7) "Æ"\r
- ["Á"]=>\r
- string(8) "Á"\r
- ["Â"]=>\r
- string(7) "Â"\r
- ["À"]=>\r
- string(8) "À"\r
- ["Α"]=>\r
- string(7) "Α"\r
- ["Å"]=>\r
- string(7) "Å"\r
- ["Ã"]=>\r
- string(8) "Ã"\r
- ["Ä"]=>\r
- string(6) "Ä"\r
- ["Β"]=>\r
- string(6) "Β"\r
- ["Ç"]=>\r
- string(8) "Ç"\r
- ["Χ"]=>\r
- string(5) "Χ"\r
- ["‡"]=>\r
- string(8) "‡"\r
- ["Δ"]=>\r
- string(7) "Δ"\r
- ["Ð"]=>\r
- string(5) "Ð"\r
- ["É"]=>\r
- string(8) "É"\r
- ["Ê"]=>\r
- string(7) "Ê"\r
- ["È"]=>\r
- string(8) "È"\r
- ["Ε"]=>\r
- string(9) "Ε"\r
- ["Η"]=>\r
- string(5) "Η"\r
- ["Ë"]=>\r
- string(6) "Ë"\r
- ["Γ"]=>\r
- string(7) "Γ"\r
- ["Í"]=>\r
- string(8) "Í"\r
- ["Î"]=>\r
- string(7) "Î"\r
- ["Ì"]=>\r
- string(8) "Ì"\r
- ["Ι"]=>\r
- string(6) "Ι"\r
- ["Ï"]=>\r
- string(6) "Ï"\r
- ["Κ"]=>\r
- string(7) "Κ"\r
- ["Λ"]=>\r
- string(8) "Λ"\r
- ["Μ"]=>\r
- string(4) "Μ"\r
- ["Ñ"]=>\r
- string(8) "Ñ"\r
- ["Ν"]=>\r
- string(4) "Ν"\r
- ["Œ"]=>\r
- string(7) "Œ"\r
- ["Ó"]=>\r
- string(8) "Ó"\r
- ["Ô"]=>\r
- string(7) "Ô"\r
- ["Ò"]=>\r
- string(8) "Ò"\r
- ["Ω"]=>\r
- string(7) "Ω"\r
- ["Ο"]=>\r
- string(9) "Ο"\r
- ["Ø"]=>\r
- string(8) "Ø"\r
- ["Õ"]=>\r
- string(8) "Õ"\r
- ["Ö"]=>\r
- string(6) "Ö"\r
- ["Φ"]=>\r
- string(5) "Φ"\r
- ["Π"]=>\r
- string(4) "Π"\r
- ["″"]=>\r
- string(7) "″"\r
- ["Ψ"]=>\r
- string(5) "Ψ"\r
- ["Ρ"]=>\r
- string(5) "Ρ"\r
- ["Š"]=>\r
- string(8) "Š"\r
- ["Σ"]=>\r
- string(7) "Σ"\r
- ["Þ"]=>\r
- string(7) "Þ"\r
- ["Τ"]=>\r
- string(5) "Τ"\r
- ["Θ"]=>\r
- string(7) "Θ"\r
- ["Ú"]=>\r
- string(8) "Ú"\r
- ["Û"]=>\r
- string(7) "Û"\r
- ["Ù"]=>\r
- string(8) "Ù"\r
- ["Υ"]=>\r
- string(9) "Υ"\r
- ["Ü"]=>\r
- string(6) "Ü"\r
- ["Ξ"]=>\r
- string(4) "Ξ"\r
- ["Ý"]=>\r
- string(8) "Ý"\r
- ["Ÿ"]=>\r
- string(6) "Ÿ"\r
- ["Ζ"]=>\r
- string(6) "Ζ"\r
- ["á"]=>\r
- string(8) "á"\r
- ["â"]=>\r
- string(7) "â"\r
- ["´"]=>\r
- string(7) "´"\r
- ["æ"]=>\r
- string(7) "æ"\r
- ["à"]=>\r
- string(8) "à"\r
- ["ℵ"]=>\r
- string(9) "ℵ"\r
- ["α"]=>\r
- string(7) "α"\r
- ["&"]=>\r
- string(5) "&"\r
- ["∧"]=>\r
- string(5) "∧"\r
- ["∠"]=>\r
- string(5) "∠"\r
- ["å"]=>\r
- string(7) "å"\r
- ["≈"]=>\r
- string(7) "≈"\r
- ["ã"]=>\r
- string(8) "ã"\r
- ["ä"]=>\r
- string(6) "ä"\r
- ["„"]=>\r
- string(7) "„"\r
- ["β"]=>\r
- string(6) "β"\r
- ["¦"]=>\r
- string(8) "¦"\r
- ["•"]=>\r
- string(6) "•"\r
- ["∩"]=>\r
- string(5) "∩"\r
- ["ç"]=>\r
- string(8) "ç"\r
- ["¸"]=>\r
- string(7) "¸"\r
- ["¢"]=>\r
- string(6) "¢"\r
- ["χ"]=>\r
- string(5) "χ"\r
- ["ˆ"]=>\r
- string(6) "ˆ"\r
- ["♣"]=>\r
- string(7) "♣"\r
- ["≅"]=>\r
- string(6) "≅"\r
- ["©"]=>\r
- string(6) "©"\r
- ["↵"]=>\r
- string(7) "↵"\r
- ["∪"]=>\r
- string(5) "∪"\r
- ["¤"]=>\r
- string(8) "¤"\r
- ["⇓"]=>\r
- string(6) "⇓"\r
- ["†"]=>\r
- string(8) "†"\r
- ["↓"]=>\r
- string(6) "↓"\r
- ["°"]=>\r
- string(5) "°"\r
- ["δ"]=>\r
- string(7) "δ"\r
- ["♦"]=>\r
- string(7) "♦"\r
- ["÷"]=>\r
- string(8) "÷"\r
- ["é"]=>\r
- string(8) "é"\r
- ["ê"]=>\r
- string(7) "ê"\r
- ["è"]=>\r
- string(8) "è"\r
- ["∅"]=>\r
- string(7) "∅"\r
- [" "]=>\r
- string(6) " "\r
- [" "]=>\r
- string(6) " "\r
- ["ε"]=>\r
- string(9) "ε"\r
- ["≡"]=>\r
- string(7) "≡"\r
- ["η"]=>\r
- string(5) "η"\r
- ["ð"]=>\r
- string(5) "ð"\r
- ["ë"]=>\r
- string(6) "ë"\r
- ["€"]=>\r
- string(6) "€"\r
- ["∃"]=>\r
- string(7) "∃"\r
- ["ƒ"]=>\r
- string(6) "ƒ"\r
- ["∀"]=>\r
- string(8) "∀"\r
- ["½"]=>\r
- string(8) "½"\r
- ["¼"]=>\r
- string(8) "¼"\r
- ["¾"]=>\r
- string(8) "¾"\r
- ["⁄"]=>\r
- string(7) "⁄"\r
- ["γ"]=>\r
- string(7) "γ"\r
- ["≥"]=>\r
- string(4) "≥"\r
- [">"]=>\r
- string(4) ">"\r
- ["⇔"]=>\r
- string(6) "⇔"\r
- ["↔"]=>\r
- string(6) "↔"\r
- ["♥"]=>\r
- string(8) "♥"\r
- ["…"]=>\r
- string(8) "…"\r
- ["í"]=>\r
- string(8) "í"\r
- ["î"]=>\r
- string(7) "î"\r
- ["¡"]=>\r
- string(7) "¡"\r
- ["ì"]=>\r
- string(8) "ì"\r
- ["ℑ"]=>\r
- string(7) "ℑ"\r
- ["∞"]=>\r
- string(7) "∞"\r
- ["∫"]=>\r
- string(5) "∫"\r
- ["ι"]=>\r
- string(6) "ι"\r
- ["¿"]=>\r
- string(8) "¿"\r
- ["∈"]=>\r
- string(6) "∈"\r
- ["ï"]=>\r
- string(6) "ï"\r
- ["κ"]=>\r
- string(7) "κ"\r
- ["⇐"]=>\r
- string(6) "⇐"\r
- ["λ"]=>\r
- string(8) "λ"\r
- ["〈"]=>\r
- string(6) "⟨"\r
- ["«"]=>\r
- string(7) "«"\r
- ["←"]=>\r
- string(6) "←"\r
- ["⌈"]=>\r
- string(7) "⌈"\r
- ["“"]=>\r
- string(7) "“"\r
- ["≤"]=>\r
- string(4) "≤"\r
- ["⌊"]=>\r
- string(8) "⌊"\r
- ["∗"]=>\r
- string(8) "∗"\r
- ["◊"]=>\r
- string(5) "◊"\r
- [""]=>\r
- string(5) "‎"\r
- ["‹"]=>\r
- string(8) "‹"\r
- ["‘"]=>\r
- string(7) "‘"\r
- ["<"]=>\r
- string(4) "<"\r
- ["¯"]=>\r
- string(6) "¯"\r
- ["—"]=>\r
- string(7) "—"\r
- ["µ"]=>\r
- string(7) "µ"\r
- ["·"]=>\r
- string(8) "·"\r
- ["−"]=>\r
- string(7) "−"\r
- ["μ"]=>\r
- string(4) "μ"\r
- ["∇"]=>\r
- string(7) "∇"\r
- [" "]=>\r
- string(6) " "\r
- ["–"]=>\r
- string(7) "–"\r
- ["≠"]=>\r
- string(4) "≠"\r
- ["∋"]=>\r
- string(4) "∋"\r
- ["¬"]=>\r
- string(5) "¬"\r
- ["∉"]=>\r
- string(7) "∉"\r
- ["⊄"]=>\r
- string(6) "⊄"\r
- ["ñ"]=>\r
- string(8) "ñ"\r
- ["ν"]=>\r
- string(4) "ν"\r
- ["ó"]=>\r
- string(8) "ó"\r
- ["ô"]=>\r
- string(7) "ô"\r
- ["œ"]=>\r
- string(7) "œ"\r
- ["ò"]=>\r
- string(8) "ò"\r
- ["‾"]=>\r
- string(7) "‾"\r
- ["ω"]=>\r
- string(7) "ω"\r
- ["ο"]=>\r
- string(9) "ο"\r
- ["⊕"]=>\r
- string(7) "⊕"\r
- ["∨"]=>\r
- string(4) "∨"\r
- ["ª"]=>\r
- string(6) "ª"\r
- ["º"]=>\r
- string(6) "º"\r
- ["ø"]=>\r
- string(8) "ø"\r
- ["õ"]=>\r
- string(8) "õ"\r
- ["⊗"]=>\r
- string(8) "⊗"\r
- ["ö"]=>\r
- string(6) "ö"\r
- ["¶"]=>\r
- string(6) "¶"\r
- ["∂"]=>\r
- string(6) "∂"\r
- ["‰"]=>\r
- string(8) "‰"\r
- ["⊥"]=>\r
- string(6) "⊥"\r
- ["φ"]=>\r
- string(5) "φ"\r
- ["π"]=>\r
- string(4) "π"\r
- ["ϖ"]=>\r
- string(5) "ϖ"\r
- ["±"]=>\r
- string(8) "±"\r
- ["£"]=>\r
- string(7) "£"\r
- ["′"]=>\r
- string(7) "′"\r
- ["∏"]=>\r
- string(6) "∏"\r
- ["∝"]=>\r
- string(6) "∝"\r
- ["ψ"]=>\r
- string(5) "ψ"\r
- ["""]=>\r
- string(6) """\r
- ["⇒"]=>\r
- string(6) "⇒"\r
- ["√"]=>\r
- string(7) "√"\r
- ["〉"]=>\r
- string(6) "⟩"\r
- ["»"]=>\r
- string(7) "»"\r
- ["→"]=>\r
- string(6) "→"\r
- ["⌉"]=>\r
- string(7) "⌉"\r
- ["”"]=>\r
- string(7) "”"\r
- ["ℜ"]=>\r
- string(6) "ℜ"\r
- ["®"]=>\r
- string(5) "®"\r
- ["⌋"]=>\r
- string(8) "⌋"\r
- ["ρ"]=>\r
- string(5) "ρ"\r
- [""]=>\r
- string(5) "‏"\r
- ["›"]=>\r
- string(8) "›"\r
- ["’"]=>\r
- string(7) "’"\r
- ["‚"]=>\r
- string(7) "‚"\r
- ["š"]=>\r
- string(8) "š"\r
- ["⋅"]=>\r
- string(6) "⋅"\r
- ["§"]=>\r
- string(6) "§"\r
- [""]=>\r
- string(5) "­"\r
- ["σ"]=>\r
- string(7) "σ"\r
- ["ς"]=>\r
- string(8) "ς"\r
- ["∼"]=>\r
- string(5) "∼"\r
- ["♠"]=>\r
- string(8) "♠"\r
- ["⊂"]=>\r
- string(5) "⊂"\r
- ["⊆"]=>\r
- string(6) "⊆"\r
- ["∑"]=>\r
- string(5) "∑"\r
- ["¹"]=>\r
- string(6) "¹"\r
- ["²"]=>\r
- string(6) "²"\r
- ["³"]=>\r
- string(6) "³"\r
- ["⊃"]=>\r
- string(5) "⊃"\r
- ["⊇"]=>\r
- string(6) "⊇"\r
- ["ß"]=>\r
- string(7) "ß"\r
- ["τ"]=>\r
- string(5) "τ"\r
- ["∴"]=>\r
- string(8) "∴"\r
- ["θ"]=>\r
- string(7) "θ"\r
- ["ϑ"]=>\r
- string(10) "ϑ"\r
- [" "]=>\r
- string(8) " "\r
- ["þ"]=>\r
- string(7) "þ"\r
- ["˜"]=>\r
- string(7) "˜"\r
- ["×"]=>\r
- string(7) "×"\r
- ["™"]=>\r
- string(7) "™"\r
- ["⇑"]=>\r
- string(6) "⇑"\r
- ["ú"]=>\r
- string(8) "ú"\r
- ["↑"]=>\r
- string(6) "↑"\r
- ["û"]=>\r
- string(7) "û"\r
- ["ù"]=>\r
- string(8) "ù"\r
- ["¨"]=>\r
- string(5) "¨"\r
- ["ϒ"]=>\r
- string(7) "ϒ"\r
- ["υ"]=>\r
- string(9) "υ"\r
- ["ü"]=>\r
- string(6) "ü"\r
- ["℘"]=>\r
- string(8) "℘"\r
- ["ξ"]=>\r
- string(4) "ξ"\r
- ["ý"]=>\r
- string(8) "ý"\r
- ["¥"]=>\r
- string(5) "¥"\r
- ["ÿ"]=>\r
- string(6) "ÿ"\r
- ["ζ"]=>\r
- string(6) "ζ"\r
- [""]=>\r
- string(5) "‍"\r
- [""]=>\r
- string(6) "‌"\r
-}\r
--- with table = HTML_SPECIALCHARS --\r
-array(4) {\r
- ["&"]=>\r
- string(5) "&"\r
- [">"]=>\r
- string(4) ">"\r
- ["<"]=>\r
- string(4) "<"\r
- ["""]=>\r
- string(6) """\r
-}\r
-Done\r
+--TEST--
+Test get_html_translation_table() function : basic functionality - with default args
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
+
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+echo "-- with table = HTML_ENTITIES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort($tt);
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort($tt);
+var_dump( $tt );
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with table = HTML_ENTITIES --
+array(252) {
+ ["Æ"]=>
+ string(7) "Æ"
+ ["Á"]=>
+ string(8) "Á"
+ ["Â"]=>
+ string(7) "Â"
+ ["À"]=>
+ string(8) "À"
+ ["Α"]=>
+ string(7) "Α"
+ ["Å"]=>
+ string(7) "Å"
+ ["Ã"]=>
+ string(8) "Ã"
+ ["Ä"]=>
+ string(6) "Ä"
+ ["Β"]=>
+ string(6) "Β"
+ ["Ç"]=>
+ string(8) "Ç"
+ ["Χ"]=>
+ string(5) "Χ"
+ ["‡"]=>
+ string(8) "‡"
+ ["Δ"]=>
+ string(7) "Δ"
+ ["Ð"]=>
+ string(5) "Ð"
+ ["É"]=>
+ string(8) "É"
+ ["Ê"]=>
+ string(7) "Ê"
+ ["È"]=>
+ string(8) "È"
+ ["Ε"]=>
+ string(9) "Ε"
+ ["Η"]=>
+ string(5) "Η"
+ ["Ë"]=>
+ string(6) "Ë"
+ ["Γ"]=>
+ string(7) "Γ"
+ ["Í"]=>
+ string(8) "Í"
+ ["Î"]=>
+ string(7) "Î"
+ ["Ì"]=>
+ string(8) "Ì"
+ ["Ι"]=>
+ string(6) "Ι"
+ ["Ï"]=>
+ string(6) "Ï"
+ ["Κ"]=>
+ string(7) "Κ"
+ ["Λ"]=>
+ string(8) "Λ"
+ ["Μ"]=>
+ string(4) "Μ"
+ ["Ñ"]=>
+ string(8) "Ñ"
+ ["Ν"]=>
+ string(4) "Ν"
+ ["Œ"]=>
+ string(7) "Œ"
+ ["Ó"]=>
+ string(8) "Ó"
+ ["Ô"]=>
+ string(7) "Ô"
+ ["Ò"]=>
+ string(8) "Ò"
+ ["Ω"]=>
+ string(7) "Ω"
+ ["Ο"]=>
+ string(9) "Ο"
+ ["Ø"]=>
+ string(8) "Ø"
+ ["Õ"]=>
+ string(8) "Õ"
+ ["Ö"]=>
+ string(6) "Ö"
+ ["Φ"]=>
+ string(5) "Φ"
+ ["Π"]=>
+ string(4) "Π"
+ ["″"]=>
+ string(7) "″"
+ ["Ψ"]=>
+ string(5) "Ψ"
+ ["Ρ"]=>
+ string(5) "Ρ"
+ ["Š"]=>
+ string(8) "Š"
+ ["Σ"]=>
+ string(7) "Σ"
+ ["Þ"]=>
+ string(7) "Þ"
+ ["Τ"]=>
+ string(5) "Τ"
+ ["Θ"]=>
+ string(7) "Θ"
+ ["Ú"]=>
+ string(8) "Ú"
+ ["Û"]=>
+ string(7) "Û"
+ ["Ù"]=>
+ string(8) "Ù"
+ ["Υ"]=>
+ string(9) "Υ"
+ ["Ü"]=>
+ string(6) "Ü"
+ ["Ξ"]=>
+ string(4) "Ξ"
+ ["Ý"]=>
+ string(8) "Ý"
+ ["Ÿ"]=>
+ string(6) "Ÿ"
+ ["Ζ"]=>
+ string(6) "Ζ"
+ ["á"]=>
+ string(8) "á"
+ ["â"]=>
+ string(7) "â"
+ ["´"]=>
+ string(7) "´"
+ ["æ"]=>
+ string(7) "æ"
+ ["à"]=>
+ string(8) "à"
+ ["ℵ"]=>
+ string(9) "ℵ"
+ ["α"]=>
+ string(7) "α"
+ ["&"]=>
+ string(5) "&"
+ ["∧"]=>
+ string(5) "∧"
+ ["∠"]=>
+ string(5) "∠"
+ ["å"]=>
+ string(7) "å"
+ ["≈"]=>
+ string(7) "≈"
+ ["ã"]=>
+ string(8) "ã"
+ ["ä"]=>
+ string(6) "ä"
+ ["„"]=>
+ string(7) "„"
+ ["β"]=>
+ string(6) "β"
+ ["¦"]=>
+ string(8) "¦"
+ ["•"]=>
+ string(6) "•"
+ ["∩"]=>
+ string(5) "∩"
+ ["ç"]=>
+ string(8) "ç"
+ ["¸"]=>
+ string(7) "¸"
+ ["¢"]=>
+ string(6) "¢"
+ ["χ"]=>
+ string(5) "χ"
+ ["ˆ"]=>
+ string(6) "ˆ"
+ ["♣"]=>
+ string(7) "♣"
+ ["≅"]=>
+ string(6) "≅"
+ ["©"]=>
+ string(6) "©"
+ ["↵"]=>
+ string(7) "↵"
+ ["∪"]=>
+ string(5) "∪"
+ ["¤"]=>
+ string(8) "¤"
+ ["⇓"]=>
+ string(6) "⇓"
+ ["†"]=>
+ string(8) "†"
+ ["↓"]=>
+ string(6) "↓"
+ ["°"]=>
+ string(5) "°"
+ ["δ"]=>
+ string(7) "δ"
+ ["♦"]=>
+ string(7) "♦"
+ ["÷"]=>
+ string(8) "÷"
+ ["é"]=>
+ string(8) "é"
+ ["ê"]=>
+ string(7) "ê"
+ ["è"]=>
+ string(8) "è"
+ ["∅"]=>
+ string(7) "∅"
+ [" "]=>
+ string(6) " "
+ [" "]=>
+ string(6) " "
+ ["ε"]=>
+ string(9) "ε"
+ ["≡"]=>
+ string(7) "≡"
+ ["η"]=>
+ string(5) "η"
+ ["ð"]=>
+ string(5) "ð"
+ ["ë"]=>
+ string(6) "ë"
+ ["€"]=>
+ string(6) "€"
+ ["∃"]=>
+ string(7) "∃"
+ ["ƒ"]=>
+ string(6) "ƒ"
+ ["∀"]=>
+ string(8) "∀"
+ ["½"]=>
+ string(8) "½"
+ ["¼"]=>
+ string(8) "¼"
+ ["¾"]=>
+ string(8) "¾"
+ ["⁄"]=>
+ string(7) "⁄"
+ ["γ"]=>
+ string(7) "γ"
+ ["≥"]=>
+ string(4) "≥"
+ [">"]=>
+ string(4) ">"
+ ["⇔"]=>
+ string(6) "⇔"
+ ["↔"]=>
+ string(6) "↔"
+ ["♥"]=>
+ string(8) "♥"
+ ["…"]=>
+ string(8) "…"
+ ["í"]=>
+ string(8) "í"
+ ["î"]=>
+ string(7) "î"
+ ["¡"]=>
+ string(7) "¡"
+ ["ì"]=>
+ string(8) "ì"
+ ["ℑ"]=>
+ string(7) "ℑ"
+ ["∞"]=>
+ string(7) "∞"
+ ["∫"]=>
+ string(5) "∫"
+ ["ι"]=>
+ string(6) "ι"
+ ["¿"]=>
+ string(8) "¿"
+ ["∈"]=>
+ string(6) "∈"
+ ["ï"]=>
+ string(6) "ï"
+ ["κ"]=>
+ string(7) "κ"
+ ["⇐"]=>
+ string(6) "⇐"
+ ["λ"]=>
+ string(8) "λ"
+ ["〈"]=>
+ string(6) "⟨"
+ ["«"]=>
+ string(7) "«"
+ ["←"]=>
+ string(6) "←"
+ ["⌈"]=>
+ string(7) "⌈"
+ ["“"]=>
+ string(7) "“"
+ ["≤"]=>
+ string(4) "≤"
+ ["⌊"]=>
+ string(8) "⌊"
+ ["∗"]=>
+ string(8) "∗"
+ ["◊"]=>
+ string(5) "◊"
+ [""]=>
+ string(5) "‎"
+ ["‹"]=>
+ string(8) "‹"
+ ["‘"]=>
+ string(7) "‘"
+ ["<"]=>
+ string(4) "<"
+ ["¯"]=>
+ string(6) "¯"
+ ["—"]=>
+ string(7) "—"
+ ["µ"]=>
+ string(7) "µ"
+ ["·"]=>
+ string(8) "·"
+ ["−"]=>
+ string(7) "−"
+ ["μ"]=>
+ string(4) "μ"
+ ["∇"]=>
+ string(7) "∇"
+ [" "]=>
+ string(6) " "
+ ["–"]=>
+ string(7) "–"
+ ["≠"]=>
+ string(4) "≠"
+ ["∋"]=>
+ string(4) "∋"
+ ["¬"]=>
+ string(5) "¬"
+ ["∉"]=>
+ string(7) "∉"
+ ["⊄"]=>
+ string(6) "⊄"
+ ["ñ"]=>
+ string(8) "ñ"
+ ["ν"]=>
+ string(4) "ν"
+ ["ó"]=>
+ string(8) "ó"
+ ["ô"]=>
+ string(7) "ô"
+ ["œ"]=>
+ string(7) "œ"
+ ["ò"]=>
+ string(8) "ò"
+ ["‾"]=>
+ string(7) "‾"
+ ["ω"]=>
+ string(7) "ω"
+ ["ο"]=>
+ string(9) "ο"
+ ["⊕"]=>
+ string(7) "⊕"
+ ["∨"]=>
+ string(4) "∨"
+ ["ª"]=>
+ string(6) "ª"
+ ["º"]=>
+ string(6) "º"
+ ["ø"]=>
+ string(8) "ø"
+ ["õ"]=>
+ string(8) "õ"
+ ["⊗"]=>
+ string(8) "⊗"
+ ["ö"]=>
+ string(6) "ö"
+ ["¶"]=>
+ string(6) "¶"
+ ["∂"]=>
+ string(6) "∂"
+ ["‰"]=>
+ string(8) "‰"
+ ["⊥"]=>
+ string(6) "⊥"
+ ["φ"]=>
+ string(5) "φ"
+ ["π"]=>
+ string(4) "π"
+ ["ϖ"]=>
+ string(5) "ϖ"
+ ["±"]=>
+ string(8) "±"
+ ["£"]=>
+ string(7) "£"
+ ["′"]=>
+ string(7) "′"
+ ["∏"]=>
+ string(6) "∏"
+ ["∝"]=>
+ string(6) "∝"
+ ["ψ"]=>
+ string(5) "ψ"
+ ["""]=>
+ string(6) """
+ ["⇒"]=>
+ string(6) "⇒"
+ ["√"]=>
+ string(7) "√"
+ ["〉"]=>
+ string(6) "⟩"
+ ["»"]=>
+ string(7) "»"
+ ["→"]=>
+ string(6) "→"
+ ["⌉"]=>
+ string(7) "⌉"
+ ["”"]=>
+ string(7) "”"
+ ["ℜ"]=>
+ string(6) "ℜ"
+ ["®"]=>
+ string(5) "®"
+ ["⌋"]=>
+ string(8) "⌋"
+ ["ρ"]=>
+ string(5) "ρ"
+ [""]=>
+ string(5) "‏"
+ ["›"]=>
+ string(8) "›"
+ ["’"]=>
+ string(7) "’"
+ ["‚"]=>
+ string(7) "‚"
+ ["š"]=>
+ string(8) "š"
+ ["⋅"]=>
+ string(6) "⋅"
+ ["§"]=>
+ string(6) "§"
+ [""]=>
+ string(5) "­"
+ ["σ"]=>
+ string(7) "σ"
+ ["ς"]=>
+ string(8) "ς"
+ ["∼"]=>
+ string(5) "∼"
+ ["♠"]=>
+ string(8) "♠"
+ ["⊂"]=>
+ string(5) "⊂"
+ ["⊆"]=>
+ string(6) "⊆"
+ ["∑"]=>
+ string(5) "∑"
+ ["¹"]=>
+ string(6) "¹"
+ ["²"]=>
+ string(6) "²"
+ ["³"]=>
+ string(6) "³"
+ ["⊃"]=>
+ string(5) "⊃"
+ ["⊇"]=>
+ string(6) "⊇"
+ ["ß"]=>
+ string(7) "ß"
+ ["τ"]=>
+ string(5) "τ"
+ ["∴"]=>
+ string(8) "∴"
+ ["θ"]=>
+ string(7) "θ"
+ ["ϑ"]=>
+ string(10) "ϑ"
+ [" "]=>
+ string(8) " "
+ ["þ"]=>
+ string(7) "þ"
+ ["˜"]=>
+ string(7) "˜"
+ ["×"]=>
+ string(7) "×"
+ ["™"]=>
+ string(7) "™"
+ ["⇑"]=>
+ string(6) "⇑"
+ ["ú"]=>
+ string(8) "ú"
+ ["↑"]=>
+ string(6) "↑"
+ ["û"]=>
+ string(7) "û"
+ ["ù"]=>
+ string(8) "ù"
+ ["¨"]=>
+ string(5) "¨"
+ ["ϒ"]=>
+ string(7) "ϒ"
+ ["υ"]=>
+ string(9) "υ"
+ ["ü"]=>
+ string(6) "ü"
+ ["℘"]=>
+ string(8) "℘"
+ ["ξ"]=>
+ string(4) "ξ"
+ ["ý"]=>
+ string(8) "ý"
+ ["¥"]=>
+ string(5) "¥"
+ ["ÿ"]=>
+ string(6) "ÿ"
+ ["ζ"]=>
+ string(6) "ζ"
+ [""]=>
+ string(5) "‍"
+ [""]=>
+ string(6) "‌"
+}
+-- with table = HTML_SPECIALCHARS --
+array(4) {
+ ["&"]=>
+ string(5) "&"
+ [">"]=>
+ string(4) ">"
+ ["<"]=>
+ string(4) "<"
+ ["""]=>
+ string(6) """
+}
+Done
---TEST--\r
-Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences\r
---FILE--\r
-<?php\r
-\r
-/* conformance to Unicode 5.2, section 3.9, D92 */\r
-\r
-$val_ranges = array(\r
- array(array(0x00, 0x7F)),\r
- array(array(0xC2, 0xDF), array(0x80, 0xBF)),\r
- array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),\r
- array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),\r
- array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),\r
- array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),\r
- array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),\r
- array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),\r
- array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),\r
-);\r
-\r
-function is_valid($seq) {\r
- global $val_ranges;\r
- $b = ord($seq[0]);\r
- foreach ($val_ranges as $l) {\r
- if ($b >= $l[0][0] && $b <= $l[0][1]) {\r
- if (count($l) != strlen($seq)) {\r
- return false;\r
- }\r
- for ($n = 1; $n < strlen($seq); $n++) {\r
- if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\r
- }\r
- return false;\r
-}\r
-\r
-function concordance($s) {\r
- $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;\r
- $v = is_valid($s);\r
- return ($vhe === $v);\r
-}\r
-\r
-for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {\r
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {\r
- $s = chr($b1).chr($b2);\r
- if (!concordance($s))\r
- echo "Discordance for ".bin2hex($s),"\n";\r
- }\r
-}\r
-\r
-\r
-for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {\r
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {\r
- $s = chr($b1).chr($b2)."\x80";\r
- if (!concordance($s))\r
- echo "Discordance for ".bin2hex($s),"\n";\r
- $s = chr($b1).chr($b2)."\xBF";\r
- if (!concordance($s))\r
- echo "Discordance for ".bin2hex($s),"\n";\r
- }\r
-}\r
-\r
-for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {\r
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {\r
- $s = chr($b1).chr($b2)."\x80\x80";\r
- if (!concordance($s))\r
- echo "Discordance for ".bin2hex($s),"\n";\r
- $s = chr($b1).chr($b2)."\xBF\x80";\r
- if (!concordance($s))\r
- echo "Discordance for ".bin2hex($s),"\n";\r
- $s = chr($b1).chr($b2)."\x80\xBF";\r
- if (!concordance($s))\r
- echo "Discordance for ".bin2hex($s),"\n";\r
- $s = chr($b1).chr($b2)."\xBF\xBF";\r
- if (!concordance($s))\r
- echo "Discordance for ".bin2hex($s),"\n";\r
- }\r
-}\r
-echo "Done.\n";\r
---EXPECT--\r
-Done.\r
+--TEST--
+Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences
+--FILE--
+<?php
+
+/* conformance to Unicode 5.2, section 3.9, D92 */
+
+$val_ranges = array(
+ array(array(0x00, 0x7F)),
+ array(array(0xC2, 0xDF), array(0x80, 0xBF)),
+ array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),
+ array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),
+ array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),
+);
+
+function is_valid($seq) {
+ global $val_ranges;
+ $b = ord($seq[0]);
+ foreach ($val_ranges as $l) {
+ if ($b >= $l[0][0] && $b <= $l[0][1]) {
+ if (count($l) != strlen($seq)) {
+ return false;
+ }
+ for ($n = 1; $n < strlen($seq); $n++) {
+ if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+function concordance($s) {
+ $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
+ $v = is_valid($s);
+ return ($vhe === $v);
+}
+
+for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2);
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+
+
+for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2)."\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+
+for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2)."\x80\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\x80\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+echo "Done.\n";
+--EXPECT--
+Done.
---TEST--\r
-Test md5() function : basic functionality \r
---FILE--\r
-<?php\r
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )\r
- * Description: Calculate the md5 hash of a string\r
- * Source code: ext/standard/md5.c\r
-*/\r
-\r
-echo "*** Testing md5() : basic functionality ***\n";\r
-var_dump(md5(b"apple"));\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-*** Testing md5() : basic functionality ***\r
-string(32) "1f3870be274f6c49b3e31a0c6728957f"\r
-===DONE===\r
+--TEST--
+Test md5() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : basic functionality ***\n";
+var_dump(md5(b"apple"));
+?>
+===DONE===
+--EXPECTF--
+*** Testing md5() : basic functionality ***
+string(32) "1f3870be274f6c49b3e31a0c6728957f"
+===DONE===
---TEST--\r
-Test md5() function : basic functionality - with raw output\r
---FILE--\r
-<?php\r
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )\r
- * Description: Calculate the md5 hash of a string\r
- * Source code: ext/standard/md5.c\r
-*/\r
-\r
-echo "*** Testing md5() : basic functionality - with raw output***\n";\r
-$str = b"Hello World";\r
-$md5_raw = md5($str, true);\r
-var_dump(bin2hex($md5_raw));\r
-\r
-$md5 = md5($str, false);\r
- \r
-if (strcmp(bin2hex($md5_raw), $md5) == 0 ) {\r
- echo "TEST PASSED\n";\r
-} else {\r
- echo "TEST FAILED\n";\r
- var_dump($md5_raw, $md5);\r
-}\r
-\r
-?>\r
-===DONE===\r
---EXPECT--\r
-*** Testing md5() : basic functionality - with raw output***\r
-string(32) "b10a8db164e0754105b7a99be72e3fe5"\r
-TEST PASSED\r
+--TEST--
+Test md5() function : basic functionality - with raw output
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : basic functionality - with raw output***\n";
+$str = b"Hello World";
+$md5_raw = md5($str, true);
+var_dump(bin2hex($md5_raw));
+
+$md5 = md5($str, false);
+
+if (strcmp(bin2hex($md5_raw), $md5) == 0 ) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+ var_dump($md5_raw, $md5);
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing md5() : basic functionality - with raw output***
+string(32) "b10a8db164e0754105b7a99be72e3fe5"
+TEST PASSED
===DONE===
\ No newline at end of file
---TEST--\r
-Test md5() function : error conditions\r
---FILE--\r
-<?php\r
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )\r
- * Description: Calculate the md5 hash of a string\r
- * Source code: ext/standard/md5.c\r
-*/\r
-\r
-echo "*** Testing md5() : error conditions ***\n";\r
-\r
-echo "\n-- Testing md5() function with no arguments --\n";\r
-var_dump( md5());\r
-\r
-echo "\n-- Testing md5() function with more than expected no. of arguments --\n";\r
-$str = "Hello World";\r
-$raw_output = true;\r
-$extra_arg = 10;\r
-\r
-var_dump(md5($str, $raw_output, $extra_arg));\r
-?>\r
-===DONE==\r
---EXPECTF--\r
-*** Testing md5() : error conditions ***\r
-\r
--- Testing md5() function with no arguments --\r
-\r
-Warning: md5() expects at least 1 parameter, 0 given in %s on line %d\r
-NULL\r
-\r
--- Testing md5() function with more than expected no. of arguments --\r
-\r
-Warning: md5() expects at most 2 parameters, 3 given in %s on line %d\r
-NULL\r
+--TEST--
+Test md5() function : error conditions
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : error conditions ***\n";
+
+echo "\n-- Testing md5() function with no arguments --\n";
+var_dump( md5());
+
+echo "\n-- Testing md5() function with more than expected no. of arguments --\n";
+$str = "Hello World";
+$raw_output = true;
+$extra_arg = 10;
+
+var_dump(md5($str, $raw_output, $extra_arg));
+?>
+===DONE==
+--EXPECTF--
+*** Testing md5() : error conditions ***
+
+-- Testing md5() function with no arguments --
+
+Warning: md5() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing md5() function with more than expected no. of arguments --
+
+Warning: md5() expects at most 2 parameters, 3 given in %s on line %d
+NULL
===DONE==
\ No newline at end of file
---TEST--\r
-Test soundex() function : basic functionality\r
---FILE--\r
-<?php\r
-/* Prototype : string soundex ( string $str )\r
- * Description: Calculate the soundex key of a string\r
- * Source code: ext/standard/string.c\r
-*/\r
-echo "*** Testing soundex() : basic functionality ***\n";\r
-\r
-var_dump(soundex("Euler"));\r
-var_dump(soundex("Gauss")); \r
-var_dump(soundex("Hilbert")); \r
-var_dump(soundex("Knuth")); \r
-var_dump(soundex("Lloyd"));\r
-var_dump(soundex("Lukasiewicz"));\r
-\r
-var_dump(soundex("Euler") == soundex("Ellery")); // E460\r
-var_dump(soundex("Gauss") == soundex("Ghosh")); // G200\r
-var_dump(soundex("Hilbert") == soundex("Heilbronn")); // H416\r
-var_dump(soundex("Knuth") == soundex("Kant")); // K530\r
-var_dump(soundex("Lloyd") == soundex("Ladd")); // L300\r
-var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222\r
-\r
-var_dump(soundex("Lukasiewicz") == soundex("Ghosh"));\r
-var_dump(soundex("Hilbert") == soundex("Ladd")); \r
-?> \r
-===DONE===\r
---EXPECT--\r
-*** Testing soundex() : basic functionality ***\r
-string(4) "E460"\r
-string(4) "G200"\r
-string(4) "H416"\r
-string(4) "K530"\r
-string(4) "L300"\r
-string(4) "L222"\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(true)\r
-bool(false)\r
-bool(false)\r
- \r
-===DONE===\r
+--TEST--
+Test soundex() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string soundex ( string $str )
+ * Description: Calculate the soundex key of a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing soundex() : basic functionality ***\n";
+
+var_dump(soundex("Euler"));
+var_dump(soundex("Gauss"));
+var_dump(soundex("Hilbert"));
+var_dump(soundex("Knuth"));
+var_dump(soundex("Lloyd"));
+var_dump(soundex("Lukasiewicz"));
+
+var_dump(soundex("Euler") == soundex("Ellery")); // E460
+var_dump(soundex("Gauss") == soundex("Ghosh")); // G200
+var_dump(soundex("Hilbert") == soundex("Heilbronn")); // H416
+var_dump(soundex("Knuth") == soundex("Kant")); // K530
+var_dump(soundex("Lloyd") == soundex("Ladd")); // L300
+var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222
+
+var_dump(soundex("Lukasiewicz") == soundex("Ghosh"));
+var_dump(soundex("Hilbert") == soundex("Ladd"));
+?>
+===DONE===
+--EXPECT--
+*** Testing soundex() : basic functionality ***
+string(4) "E460"
+string(4) "G200"
+string(4) "H416"
+string(4) "K530"
+string(4) "L300"
+string(4) "L222"
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+
+===DONE===
---TEST--\r
-Test soundex() function : error conditions\r
---FILE--\r
-<?php\r
-/* Prototype : string soundex ( string $str )\r
- * Description: Calculate the soundex key of a string\r
- * Source code: ext/standard/string.c\r
-*/\r
- \r
-echo "\n*** Testing soundex error conditions ***";\r
-\r
-echo "-- Testing soundex() function with Zero arguments --\n";\r
-var_dump( soundex() );\r
-\r
-echo "\n\n-- Testing soundex() function with more than expected no. of arguments --\n";\r
-$str = "Euler";\r
-$extra_arg = 10;\r
-var_dump( soundex( $str, $extra_arg) );\r
-\r
-?> \r
-===DONE===\r
---EXPECTF--\r
-*** Testing soundex error conditions ***-- Testing soundex() function with Zero arguments --\r
-\r
-Warning: soundex() expects exactly 1 parameter, 0 given in %s on line %d\r
-NULL\r
-\r
-\r
--- Testing soundex() function with more than expected no. of arguments --\r
-\r
-Warning: soundex() expects exactly 1 parameter, 2 given in %s on line %d\r
-NULL\r
- \r
+--TEST--
+Test soundex() function : error conditions
+--FILE--
+<?php
+/* Prototype : string soundex ( string $str )
+ * Description: Calculate the soundex key of a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "\n*** Testing soundex error conditions ***";
+
+echo "-- Testing soundex() function with Zero arguments --\n";
+var_dump( soundex() );
+
+echo "\n\n-- Testing soundex() function with more than expected no. of arguments --\n";
+$str = "Euler";
+$extra_arg = 10;
+var_dump( soundex( $str, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing soundex error conditions ***-- Testing soundex() function with Zero arguments --
+
+Warning: soundex() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+
+-- Testing soundex() function with more than expected no. of arguments --
+
+Warning: soundex() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
===DONE===
\ No newline at end of file
---TEST--\r
-Test soundex() function : basic functionality\r
---FILE--\r
-<?php\r
-/* Prototype : string str_rot13 ( string $str )\r
- * Description: Perform the rot13 transform on a string\r
- * Source code: ext/standard/string.c\r
-*/\r
-echo "*** Testing str_rot13() : basic functionality ***\n";\r
-\r
-echo "\nBasic tests\n";\r
-var_dump(str_rot13("str_rot13() tests starting"));\r
-var_dump(str_rot13("abcdefghijklmnopqrstuvwxyz"));\r
-\r
-echo "\nEnsure numeric characters are left untouched\n";\r
-if (strcmp(str_rot13("0123456789"), "0123456789") == 0) {\r
- echo "Strings equal : TEST PASSED\n"; \r
-} else {\r
- echo "Strings unequal : TEST FAILED\n"; \r
-}\r
-\r
-echo "\nEnsure non-alphabetic characters are left untouched\n";\r
-if (strcmp(str_rot13("!%^&*()_-+={}[]:;@~#<,>.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) {\r
- echo "Strings equal : TEST PASSED\n"; \r
-} else {\r
- echo "Strings unequal : TEST FAILED\n"; \r
-}\r
-\r
-echo "\nEnsure strings round trip\n";\r
-$str = "str_rot13() tests starting";\r
-$encode = str_rot13($str);\r
-$decode = str_rot13($encode);\r
-if (strcmp($str, $decode) == 0) {\r
- echo "Strings equal : TEST PASSED\n"; \r
-} else {\r
- echo "Strings unequal : TEST FAILED\n"; \r
-}\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-*** Testing str_rot13() : basic functionality ***\r
-\r
-Basic tests\r
-string(26) "fge_ebg13() grfgf fgnegvat"\r
-string(26) "nopqrstuvwxyzabcdefghijklm"\r
-\r
-Ensure numeric characters are left untouched\r
-Strings equal : TEST PASSED\r
-\r
-Ensure non-alphabetic characters are left untouched\r
-Strings unequal : TEST FAILED\r
-\r
-Ensure strings round trip\r
-Strings equal : TEST PASSED\r
+--TEST--
+Test soundex() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string str_rot13 ( string $str )
+ * Description: Perform the rot13 transform on a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing str_rot13() : basic functionality ***\n";
+
+echo "\nBasic tests\n";
+var_dump(str_rot13("str_rot13() tests starting"));
+var_dump(str_rot13("abcdefghijklmnopqrstuvwxyz"));
+
+echo "\nEnsure numeric characters are left untouched\n";
+if (strcmp(str_rot13("0123456789"), "0123456789") == 0) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+
+echo "\nEnsure non-alphabetic characters are left untouched\n";
+if (strcmp(str_rot13("!%^&*()_-+={}[]:;@~#<,>.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+
+echo "\nEnsure strings round trip\n";
+$str = "str_rot13() tests starting";
+$encode = str_rot13($str);
+$decode = str_rot13($encode);
+if (strcmp($str, $decode) == 0) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_rot13() : basic functionality ***
+
+Basic tests
+string(26) "fge_ebg13() grfgf fgnegvat"
+string(26) "nopqrstuvwxyzabcdefghijklm"
+
+Ensure numeric characters are left untouched
+Strings equal : TEST PASSED
+
+Ensure non-alphabetic characters are left untouched
+Strings unequal : TEST FAILED
+
+Ensure strings round trip
+Strings equal : TEST PASSED
===DONE===
\ No newline at end of file
---TEST--\r
-Test str_rot13() function : error conditions\r
---FILE--\r
-<?php\r
-/* Prototype : string str_rot13 ( string $str )\r
- * Description: Perform the rot13 transform on a string\r
- * Source code: ext/standard/string.c\r
-*/\r
-echo "*** Testing str_rot13() : error conditions ***\n";\r
-\r
-echo "-- Testing str_rot13() function with Zero arguments --\n";\r
-var_dump( str_rot13() );\r
-\r
-echo "\n\n-- Testing str_rot13() function with more than expected no. of arguments --\n";\r
-$str = "str_rot13() tests starting";\r
-$extra_arg = 10;\r
-var_dump( str_rot13( $str, $extra_arg) );\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-*** Testing str_rot13() : error conditions ***\r
--- Testing str_rot13() function with Zero arguments --\r
-\r
-Warning: str_rot13() expects exactly 1 parameter, 0 given in %s on line %d\r
-NULL\r
-\r
-\r
--- Testing str_rot13() function with more than expected no. of arguments --\r
-\r
-Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d\r
-NULL\r
+--TEST--
+Test str_rot13() function : error conditions
+--FILE--
+<?php
+/* Prototype : string str_rot13 ( string $str )
+ * Description: Perform the rot13 transform on a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing str_rot13() : error conditions ***\n";
+
+echo "-- Testing str_rot13() function with Zero arguments --\n";
+var_dump( str_rot13() );
+
+echo "\n\n-- Testing str_rot13() function with more than expected no. of arguments --\n";
+$str = "str_rot13() tests starting";
+$extra_arg = 10;
+var_dump( str_rot13( $str, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_rot13() : error conditions ***
+-- Testing str_rot13() function with Zero arguments --
+
+Warning: str_rot13() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+
+-- Testing str_rot13() function with more than expected no. of arguments --
+
+Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
===DONE===
\ No newline at end of file
---TEST--\r
-Test strnatcasecmp() function : error conditions \r
---FILE--\r
-<?php\r
-/* Prototype : int strnatcasecmp ( string $str1 , string $str2 )\r
- * Description: Case insensitive string comparisons using a "natural order" algorithm\r
- * Source code: ext/standard/string.c\r
-*/\r
-echo "*** Testing strnatcasecmp() : error conditions ***\n";\r
-\r
-echo "-- Testing strnatcmp() function with Zero arguments --\n";\r
-var_dump( strnatcasecmp() );\r
-\r
-echo "\n\n-- Testing strnatcasecmp() function with more than expected no. of arguments --\n";\r
-$str1 = "abc1";\r
-$str2 = "ABC1";\r
-$extra_arg = 10;\r
-var_dump( strnatcasecmp( $str1, $str2, $extra_arg) );\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-*** Testing strnatcasecmp() : error conditions ***\r
--- Testing strnatcmp() function with Zero arguments --\r
-\r
-Warning: strnatcasecmp() expects exactly 2 parameters, 0 given in %s on line %d\r
-NULL\r
-\r
-\r
--- Testing strnatcasecmp() function with more than expected no. of arguments --\r
-\r
-Warning: strnatcasecmp() expects exactly 2 parameters, 3 given in %s on line %d\r
-NULL\r
+--TEST--
+Test strnatcasecmp() function : error conditions
+--FILE--
+<?php
+/* Prototype : int strnatcasecmp ( string $str1 , string $str2 )
+ * Description: Case insensitive string comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcasecmp() : error conditions ***\n";
+
+echo "-- Testing strnatcmp() function with Zero arguments --\n";
+var_dump( strnatcasecmp() );
+
+echo "\n\n-- Testing strnatcasecmp() function with more than expected no. of arguments --\n";
+$str1 = "abc1";
+$str2 = "ABC1";
+$extra_arg = 10;
+var_dump( strnatcasecmp( $str1, $str2, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing strnatcasecmp() : error conditions ***
+-- Testing strnatcmp() function with Zero arguments --
+
+Warning: strnatcasecmp() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+
+-- Testing strnatcasecmp() function with more than expected no. of arguments --
+
+Warning: strnatcasecmp() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
===DONE===
\ No newline at end of file
---TEST--\r
-Test strnatcmp() function : basic functionality\r
---FILE--\r
-<?php\r
-/* Prototype : int strnatcmp ( string $str1 , string $str2 )\r
- * Description: String comparisons using a "natural order" algorithm\r
- * Source code: ext/standard/string.c\r
-*/\r
-echo "*** Testing strnatcmp() : basic functionality ***\n";\r
-\r
-$a1 = "abc1";\r
-$b1 = "abc10";\r
-$c1 = "abc15";\r
-$d1 = "abc2";\r
-\r
-$a2 = "ABC1";\r
-$b2 = "ABC10";\r
-$c2 = "ABC15";\r
-$d2 = "ABC2";\r
-\r
-echo "Less than tests\n";\r
-var_dump(strnatcmp($a1, $b1));\r
-var_dump(strnatcmp($a1, $c1));\r
-var_dump(strnatcmp($a1, $d1));\r
-var_dump(strnatcmp($b1, $c1));\r
-var_dump(strnatcmp($d1, $c1));\r
-\r
-var_dump(strnatcmp($a1, $b2));\r
-var_dump(strnatcmp($a1, $c2));\r
-var_dump(strnatcmp($a1, $d2));\r
-var_dump(strnatcmp($b1, $c2));\r
-var_dump(strnatcmp($d1, $c2));\r
-\r
-\r
-echo "Equal too tests\n";\r
-var_dump(strnatcmp($b1, $b1));\r
-var_dump(strnatcmp($b1, $b2)); \r
-\r
-echo "Greater than tests\n";\r
-var_dump(strnatcmp($b1, $a1));\r
-var_dump(strnatcmp($c1, $a1));\r
-var_dump(strnatcmp($d1, $a1));\r
-var_dump(strnatcmp($c1, $b1));\r
-var_dump(strnatcmp($c1, $d1));\r
-\r
-var_dump(strnatcmp($b1, $a2));\r
-var_dump(strnatcmp($c1, $a2));\r
-var_dump(strnatcmp($d1, $a2));\r
-var_dump(strnatcmp($c1, $b2));\r
-var_dump(strnatcmp($c1, $d2));\r
-?>\r
-===DONE===\r
---EXPECT--\r
-*** Testing strnatcmp() : basic functionality ***\r
-Less than tests\r
-int(-1)\r
-int(-1)\r
-int(-1)\r
-int(-1)\r
-int(-1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-Equal too tests\r
-int(0)\r
-int(1)\r
-Greater than tests\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
-int(1)\r
+--TEST--
+Test strnatcmp() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int strnatcmp ( string $str1 , string $str2 )
+ * Description: String comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcmp() : basic functionality ***\n";
+
+$a1 = "abc1";
+$b1 = "abc10";
+$c1 = "abc15";
+$d1 = "abc2";
+
+$a2 = "ABC1";
+$b2 = "ABC10";
+$c2 = "ABC15";
+$d2 = "ABC2";
+
+echo "Less than tests\n";
+var_dump(strnatcmp($a1, $b1));
+var_dump(strnatcmp($a1, $c1));
+var_dump(strnatcmp($a1, $d1));
+var_dump(strnatcmp($b1, $c1));
+var_dump(strnatcmp($d1, $c1));
+
+var_dump(strnatcmp($a1, $b2));
+var_dump(strnatcmp($a1, $c2));
+var_dump(strnatcmp($a1, $d2));
+var_dump(strnatcmp($b1, $c2));
+var_dump(strnatcmp($d1, $c2));
+
+
+echo "Equal too tests\n";
+var_dump(strnatcmp($b1, $b1));
+var_dump(strnatcmp($b1, $b2));
+
+echo "Greater than tests\n";
+var_dump(strnatcmp($b1, $a1));
+var_dump(strnatcmp($c1, $a1));
+var_dump(strnatcmp($d1, $a1));
+var_dump(strnatcmp($c1, $b1));
+var_dump(strnatcmp($c1, $d1));
+
+var_dump(strnatcmp($b1, $a2));
+var_dump(strnatcmp($c1, $a2));
+var_dump(strnatcmp($d1, $a2));
+var_dump(strnatcmp($c1, $b2));
+var_dump(strnatcmp($c1, $d2));
+?>
+===DONE===
+--EXPECT--
+*** Testing strnatcmp() : basic functionality ***
+Less than tests
+int(-1)
+int(-1)
+int(-1)
+int(-1)
+int(-1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+Equal too tests
+int(0)
+int(1)
+Greater than tests
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
===DONE===
\ No newline at end of file
---TEST--\r
-Test strnatcmp() function : error conditions\r
---FILE--\r
-<?php\r
-/* Prototype : int strnatcmp ( string $str1 , string $str2 )\r
- * Description: String comparisons using a "natural order" algorithm\r
- * Source code: ext/standard/string.c\r
-*/\r
-echo "*** Testing strnatcmp() : error conditions ***\n";\r
-\r
-echo "-- Testing strnatcmp() function with Zero arguments --\n";\r
-var_dump( strnatcmp() );\r
-\r
-echo "\n\n-- Testing strnatcmp() function with more than expected no. of arguments --\n";\r
-$str1 = "abc1";\r
-$str2 = "ABC1";\r
-$extra_arg = 10;\r
-var_dump( strnatcmp( $str1, $str2, $extra_arg) );\r
-\r
-?>\r
-===DONE===\r
---EXPECTF--\r
-*** Testing strnatcmp() : error conditions ***\r
--- Testing strnatcmp() function with Zero arguments --\r
-\r
-Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d\r
-NULL\r
-\r
-\r
--- Testing strnatcmp() function with more than expected no. of arguments --\r
-\r
-Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d\r
-NULL\r
-===DONE===\r
+--TEST--
+Test strnatcmp() function : error conditions
+--FILE--
+<?php
+/* Prototype : int strnatcmp ( string $str1 , string $str2 )
+ * Description: String comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcmp() : error conditions ***\n";
+
+echo "-- Testing strnatcmp() function with Zero arguments --\n";
+var_dump( strnatcmp() );
+
+echo "\n\n-- Testing strnatcmp() function with more than expected no. of arguments --\n";
+$str1 = "abc1";
+$str2 = "ABC1";
+$extra_arg = 10;
+var_dump( strnatcmp( $str1, $str2, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strnatcmp() : error conditions ***
+-- Testing strnatcmp() function with Zero arguments --
+
+Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+
+-- Testing strnatcmp() function with more than expected no. of arguments --
+
+Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+===DONE===
---TEST--\r
-Bug #49687 Several utf8_decode deficiencies and vulnerabilities\r
---SKIPIF--\r
-<?php\r
-require_once("skipif.inc");\r
-if (!extension_loaded('xml')) die ("skip xml extension not available");\r
-?>\r
---FILE--\r
-<?php\r
-\r
-$tests = array(\r
- "\x41\xC2\x3E\x42",\r
- "\xE3\x80\x22",\r
- "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98",\r
-);\r
-foreach ($tests as $t) {\r
- echo bin2hex(utf8_decode($t)), "\n";\r
-}\r
-echo "Done.\n";\r
---EXPECT--\r
-413f3e42\r
-3f22\r
-413f3f423f433f3f\r
-Done.\r
+--TEST--
+Bug #49687 Several utf8_decode deficiencies and vulnerabilities
+--SKIPIF--
+<?php
+require_once("skipif.inc");
+if (!extension_loaded('xml')) die ("skip xml extension not available");
+?>
+--FILE--
+<?php
+
+$tests = array(
+ "\x41\xC2\x3E\x42",
+ "\xE3\x80\x22",
+ "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98",
+);
+foreach ($tests as $t) {
+ echo bin2hex(utf8_decode($t)), "\n";
+}
+echo "Done.\n";
+--EXPECT--
+413f3e42
+3f22
+413f3f423f433f3f
+Done.
---TEST--\r
-Bug #53180 (post_max_size=0 partly not working)\r
---INI--\r
-post_max_size=0\r
---POST--\r
-email=foo&password=bar&submit=Log+on\r
---FILE--\r
-<?php\r
-var_dump($_POST);\r
-?>\r
---EXPECT--\r
-array(3) {\r
- ["email"]=>\r
- string(3) "foo"\r
- ["password"]=>\r
- string(3) "bar"\r
- ["submit"]=>\r
- string(6) "Log on"\r
-}\r
+--TEST--
+Bug #53180 (post_max_size=0 partly not working)
+--INI--
+post_max_size=0
+--POST--
+email=foo&password=bar&submit=Log+on
+--FILE--
+<?php
+var_dump($_POST);
+?>
+--EXPECT--
+array(3) {
+ ["email"]=>
+ string(3) "foo"
+ ["password"]=>
+ string(3) "bar"
+ ["submit"]=>
+ string(6) "Log on"
+}
---TEST--\r
-Req #44164 (Handle "Content-Length" HTTP header when zlib.output_compression active)\r
---SKIPIF--\r
-<?php\r
-if (!function_exists('gzdeflate'))\r
- die("skip zlib extension required");\r
-?>\r
---INI--\r
-zlib.output_compression=On\r
---ENV--\r
-HTTP_ACCEPT_ENCODING=gzip\r
---FILE--\r
-<?php\r
-header("Content-length: 200");\r
-echo str_repeat("a", 200);\r
---EXPECT--\r
-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r
+--TEST--
+Req #44164 (Handle "Content-Length" HTTP header when zlib.output_compression active)
+--SKIPIF--
+<?php
+if (!function_exists('gzdeflate'))
+ die("skip zlib extension required");
+?>
+--INI--
+zlib.output_compression=On
+--ENV--
+HTTP_ACCEPT_ENCODING=gzip
+--FILE--
+<?php
+header("Content-length: 200");
+echo str_repeat("a", 200);
+--EXPECT--
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
---TEST--\r
-rfc1867 max_file_uploads - empty files shouldn't count\r
---INI--\r
-file_uploads=1\r
-max_file_uploads=2\r
---POST_RAW--\r
-Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737\r
------------------------------20896060251896012921717172737\r
-Content-Disposition: form-data; name="file2"; filename=""\r
-Content-Type: text/plain-file\r
-\r
-\r
------------------------------20896060251896012921717172737\r
-Content-Disposition: form-data; name="file3"; filename=""\r
-Content-Type: text/plain-file\r
-\r
-33\r
------------------------------20896060251896012921717172737\r
-Content-Disposition: form-data; name="file4"; filename="file4.txt"\r
-Content-Type: text/plain-file\r
-\r
-\r
------------------------------20896060251896012921717172737\r
-Content-Disposition: form-data; name="file1"; filename="file1.txt"\r
-Content-Type: text/plain-file\r
-\r
-1\r
------------------------------20896060251896012921717172737--\r
---FILE--\r
-<?php\r
-var_dump($_FILES);\r
-var_dump($_POST);\r
-if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {\r
- var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));\r
-}\r
-if (is_uploaded_file($_FILES["file4"]["tmp_name"])) {\r
- var_dump(file_get_contents($_FILES["file4"]["tmp_name"]));\r
-}\r
-?>\r
---EXPECTF--\r
-array(4) {\r
- ["file2"]=>\r
- array(5) {\r
- ["name"]=>\r
- string(0) ""\r
- ["type"]=>\r
- string(0) ""\r
- ["tmp_name"]=>\r
- string(0) ""\r
- ["error"]=>\r
- int(4)\r
- ["size"]=>\r
- int(0)\r
- }\r
- ["file3"]=>\r
- array(5) {\r
- ["name"]=>\r
- string(0) ""\r
- ["type"]=>\r
- string(0) ""\r
- ["tmp_name"]=>\r
- string(0) ""\r
- ["error"]=>\r
- int(4)\r
- ["size"]=>\r
- int(0)\r
- }\r
- ["file4"]=>\r
- array(5) {\r
- ["name"]=>\r
- string(9) "file4.txt"\r
- ["type"]=>\r
- string(15) "text/plain-file"\r
- ["tmp_name"]=>\r
- string(%d) "%s"\r
- ["error"]=>\r
- int(0)\r
- ["size"]=>\r
- int(0)\r
- }\r
- ["file1"]=>\r
- array(5) {\r
- ["name"]=>\r
- string(9) "file1.txt"\r
- ["type"]=>\r
- string(15) "text/plain-file"\r
- ["tmp_name"]=>\r
- string(%d) "%s"\r
- ["error"]=>\r
- int(0)\r
- ["size"]=>\r
- int(1)\r
- }\r
-}\r
-array(0) {\r
-}\r
-string(1) "1"\r
-string(0) ""\r
+--TEST--
+rfc1867 max_file_uploads - empty files shouldn't count
+--INI--
+file_uploads=1
+max_file_uploads=2
+--POST_RAW--
+Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file2"; filename=""
+Content-Type: text/plain-file
+
+
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file3"; filename=""
+Content-Type: text/plain-file
+
+33
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file4"; filename="file4.txt"
+Content-Type: text/plain-file
+
+
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file1"; filename="file1.txt"
+Content-Type: text/plain-file
+
+1
+-----------------------------20896060251896012921717172737--
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($_POST);
+if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
+ var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
+}
+if (is_uploaded_file($_FILES["file4"]["tmp_name"])) {
+ var_dump(file_get_contents($_FILES["file4"]["tmp_name"]));
+}
+?>
+--EXPECTF--
+array(4) {
+ ["file2"]=>
+ array(5) {
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ string(0) ""
+ ["tmp_name"]=>
+ string(0) ""
+ ["error"]=>
+ int(4)
+ ["size"]=>
+ int(0)
+ }
+ ["file3"]=>
+ array(5) {
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ string(0) ""
+ ["tmp_name"]=>
+ string(0) ""
+ ["error"]=>
+ int(4)
+ ["size"]=>
+ int(0)
+ }
+ ["file4"]=>
+ array(5) {
+ ["name"]=>
+ string(9) "file4.txt"
+ ["type"]=>
+ string(15) "text/plain-file"
+ ["tmp_name"]=>
+ string(%d) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(0)
+ }
+ ["file1"]=>
+ array(5) {
+ ["name"]=>
+ string(9) "file1.txt"
+ ["type"]=>
+ string(15) "text/plain-file"
+ ["tmp_name"]=>
+ string(%d) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(1)
+ }
+}
+array(0) {
+}
+string(1) "1"
+string(0) ""
---TEST--\r
-Foreach loop tests - basic loop with just value and key => value.\r
---FILE--\r
-<?php\r
-\r
-$a = array("a","b","c");\r
-\r
-foreach ($a as $v) {\r
- var_dump($v);\r
-}\r
-foreach ($a as $k => $v) {\r
- var_dump($k, $v);\r
-}\r
-//check key and value after the loop.\r
-var_dump($k, $v);\r
-\r
-echo "\n";\r
-//Dynamic array\r
-foreach (array("d","e","f") as $v) {\r
- var_dump($v);\r
-}\r
-foreach (array("d","e","f") as $k => $v) {\r
- var_dump($k, $v);\r
-}\r
-//check key and value after the loop.\r
-var_dump($k, $v);\r
-\r
-echo "\n";\r
-//Ensure counter is advanced during loop\r
-$a=array("a","b","c");\r
-foreach ($a as $v);\r
-var_dump(current($a));\r
-$a=array("a","b","c");\r
-foreach ($a as &$v);\r
-var_dump(current($a));\r
-\r
-?>\r
---EXPECT--\r
-string(1) "a"\r
-string(1) "b"\r
-string(1) "c"\r
-int(0)\r
-string(1) "a"\r
-int(1)\r
-string(1) "b"\r
-int(2)\r
-string(1) "c"\r
-int(2)\r
-string(1) "c"\r
-\r
-string(1) "d"\r
-string(1) "e"\r
-string(1) "f"\r
-int(0)\r
-string(1) "d"\r
-int(1)\r
-string(1) "e"\r
-int(2)\r
-string(1) "f"\r
-int(2)\r
-string(1) "f"\r
-\r
-string(1) "a"\r
+--TEST--
+Foreach loop tests - basic loop with just value and key => value.
+--FILE--
+<?php
+
+$a = array("a","b","c");
+
+foreach ($a as $v) {
+ var_dump($v);
+}
+foreach ($a as $k => $v) {
+ var_dump($k, $v);
+}
+//check key and value after the loop.
+var_dump($k, $v);
+
+echo "\n";
+//Dynamic array
+foreach (array("d","e","f") as $v) {
+ var_dump($v);
+}
+foreach (array("d","e","f") as $k => $v) {
+ var_dump($k, $v);
+}
+//check key and value after the loop.
+var_dump($k, $v);
+
+echo "\n";
+//Ensure counter is advanced during loop
+$a=array("a","b","c");
+foreach ($a as $v);
+var_dump(current($a));
+$a=array("a","b","c");
+foreach ($a as &$v);
+var_dump(current($a));
+
+?>
+--EXPECT--
+string(1) "a"
+string(1) "b"
+string(1) "c"
+int(0)
+string(1) "a"
+int(1)
+string(1) "b"
+int(2)
+string(1) "c"
+int(2)
+string(1) "c"
+
+string(1) "d"
+string(1) "e"
+string(1) "f"
+int(0)
+string(1) "d"
+int(1)
+string(1) "e"
+int(2)
+string(1) "f"
+int(2)
+string(1) "f"
+
+string(1) "a"
string(1) "a"
---TEST--\r
-Foreach loop tests - modifying the array during the loop.\r
---FILE--\r
-<?php\r
-\r
-echo "\nDirectly changing array values.\n";\r
-$a = array("original.1","original.2","original.3");\r
-foreach ($a as $k=>$v) {\r
- $a[$k]="changed.$k";\r
- var_dump($v);\r
-}\r
-var_dump($a);\r
-\r
-echo "\nModifying the foreach \$value.\n";\r
-$a = array("original.1","original.2","original.3");\r
-foreach ($a as $k=>$v) {\r
- $v="changed.$k";\r
-}\r
-var_dump($a);\r
-\r
-\r
-echo "\nModifying the foreach &\$value.\n";\r
-$a = array("original.1","original.2","original.3");\r
-foreach ($a as $k=>&$v) {\r
- $v="changed.$k";\r
-}\r
-var_dump($a);\r
-\r
-echo "\nPushing elements onto an unreferenced array.\n";\r
-$a = array("original.1","original.2","original.3");\r
-$counter=0;\r
-foreach ($a as $v) {\r
- array_push($a, "new.$counter");\r
-\r
- //avoid infinite loop if test is failing\r
- if ($counter++>10) {\r
- echo "Loop detected\n";\r
- break; \r
- }\r
-}\r
-var_dump($a);\r
-\r
-echo "\nPushing elements onto an unreferenced array, using &\$value.\n";\r
-$a = array("original.1","original.2","original.3");\r
-$counter=0;\r
-foreach ($a as &$v) {\r
- array_push($a, "new.$counter");\r
-\r
- //avoid infinite loop if test is failing\r
- if ($counter++>10) {\r
- echo "Loop detected\n";\r
- break; \r
- } \r
-}\r
-var_dump($a);\r
-\r
-echo "\nPopping elements off an unreferenced array.\n";\r
-$a = array("original.1","original.2","original.3");\r
-foreach ($a as $v) {\r
- array_pop($a);\r
- var_dump($v); \r
-}\r
-var_dump($a);\r
-\r
-echo "\nPopping elements off an unreferenced array, using &\$value.\n";\r
-$a = array("original.1","original.2","original.3");\r
-foreach ($a as &$v) {\r
- array_pop($a);\r
- var_dump($v);\r
-}\r
-var_dump($a);\r
-\r
-?>\r
---EXPECT--\r
-\r
-Directly changing array values.\r
-string(10) "original.1"\r
-string(10) "original.2"\r
-string(10) "original.3"\r
-array(3) {\r
- [0]=>\r
- string(9) "changed.0"\r
- [1]=>\r
- string(9) "changed.1"\r
- [2]=>\r
- string(9) "changed.2"\r
-}\r
-\r
-Modifying the foreach $value.\r
-array(3) {\r
- [0]=>\r
- string(10) "original.1"\r
- [1]=>\r
- string(10) "original.2"\r
- [2]=>\r
- string(10) "original.3"\r
-}\r
-\r
-Modifying the foreach &$value.\r
-array(3) {\r
- [0]=>\r
- string(9) "changed.0"\r
- [1]=>\r
- string(9) "changed.1"\r
- [2]=>\r
- &string(9) "changed.2"\r
-}\r
-\r
-Pushing elements onto an unreferenced array.\r
-array(6) {\r
- [0]=>\r
- string(10) "original.1"\r
- [1]=>\r
- string(10) "original.2"\r
- [2]=>\r
- string(10) "original.3"\r
- [3]=>\r
- string(5) "new.0"\r
- [4]=>\r
- string(5) "new.1"\r
- [5]=>\r
- string(5) "new.2"\r
-}\r
-\r
-Pushing elements onto an unreferenced array, using &$value.\r
-Loop detected\r
-array(15) {\r
- [0]=>\r
- string(10) "original.1"\r
- [1]=>\r
- string(10) "original.2"\r
- [2]=>\r
- string(10) "original.3"\r
- [3]=>\r
- string(5) "new.0"\r
- [4]=>\r
- string(5) "new.1"\r
- [5]=>\r
- string(5) "new.2"\r
- [6]=>\r
- string(5) "new.3"\r
- [7]=>\r
- string(5) "new.4"\r
- [8]=>\r
- string(5) "new.5"\r
- [9]=>\r
- string(5) "new.6"\r
- [10]=>\r
- string(5) "new.7"\r
- [11]=>\r
- &string(5) "new.8"\r
- [12]=>\r
- string(5) "new.9"\r
- [13]=>\r
- string(6) "new.10"\r
- [14]=>\r
- string(6) "new.11"\r
-}\r
-\r
-Popping elements off an unreferenced array.\r
-string(10) "original.1"\r
-string(10) "original.2"\r
-string(10) "original.3"\r
-array(0) {\r
-}\r
-\r
-Popping elements off an unreferenced array, using &$value.\r
-string(10) "original.1"\r
-string(10) "original.2"\r
-array(1) {\r
- [0]=>\r
- string(10) "original.1"\r
+--TEST--
+Foreach loop tests - modifying the array during the loop.
+--FILE--
+<?php
+
+echo "\nDirectly changing array values.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as $k=>$v) {
+ $a[$k]="changed.$k";
+ var_dump($v);
+}
+var_dump($a);
+
+echo "\nModifying the foreach \$value.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as $k=>$v) {
+ $v="changed.$k";
+}
+var_dump($a);
+
+
+echo "\nModifying the foreach &\$value.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as $k=>&$v) {
+ $v="changed.$k";
+}
+var_dump($a);
+
+echo "\nPushing elements onto an unreferenced array.\n";
+$a = array("original.1","original.2","original.3");
+$counter=0;
+foreach ($a as $v) {
+ array_push($a, "new.$counter");
+
+ //avoid infinite loop if test is failing
+ if ($counter++>10) {
+ echo "Loop detected\n";
+ break;
+ }
+}
+var_dump($a);
+
+echo "\nPushing elements onto an unreferenced array, using &\$value.\n";
+$a = array("original.1","original.2","original.3");
+$counter=0;
+foreach ($a as &$v) {
+ array_push($a, "new.$counter");
+
+ //avoid infinite loop if test is failing
+ if ($counter++>10) {
+ echo "Loop detected\n";
+ break;
+ }
+}
+var_dump($a);
+
+echo "\nPopping elements off an unreferenced array.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as $v) {
+ array_pop($a);
+ var_dump($v);
+}
+var_dump($a);
+
+echo "\nPopping elements off an unreferenced array, using &\$value.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as &$v) {
+ array_pop($a);
+ var_dump($v);
+}
+var_dump($a);
+
+?>
+--EXPECT--
+
+Directly changing array values.
+string(10) "original.1"
+string(10) "original.2"
+string(10) "original.3"
+array(3) {
+ [0]=>
+ string(9) "changed.0"
+ [1]=>
+ string(9) "changed.1"
+ [2]=>
+ string(9) "changed.2"
+}
+
+Modifying the foreach $value.
+array(3) {
+ [0]=>
+ string(10) "original.1"
+ [1]=>
+ string(10) "original.2"
+ [2]=>
+ string(10) "original.3"
+}
+
+Modifying the foreach &$value.
+array(3) {
+ [0]=>
+ string(9) "changed.0"
+ [1]=>
+ string(9) "changed.1"
+ [2]=>
+ &string(9) "changed.2"
+}
+
+Pushing elements onto an unreferenced array.
+array(6) {
+ [0]=>
+ string(10) "original.1"
+ [1]=>
+ string(10) "original.2"
+ [2]=>
+ string(10) "original.3"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.2"
+}
+
+Pushing elements onto an unreferenced array, using &$value.
+Loop detected
+array(15) {
+ [0]=>
+ string(10) "original.1"
+ [1]=>
+ string(10) "original.2"
+ [2]=>
+ string(10) "original.3"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.2"
+ [6]=>
+ string(5) "new.3"
+ [7]=>
+ string(5) "new.4"
+ [8]=>
+ string(5) "new.5"
+ [9]=>
+ string(5) "new.6"
+ [10]=>
+ string(5) "new.7"
+ [11]=>
+ &string(5) "new.8"
+ [12]=>
+ string(5) "new.9"
+ [13]=>
+ string(6) "new.10"
+ [14]=>
+ string(6) "new.11"
+}
+
+Popping elements off an unreferenced array.
+string(10) "original.1"
+string(10) "original.2"
+string(10) "original.3"
+array(0) {
+}
+
+Popping elements off an unreferenced array, using &$value.
+string(10) "original.1"
+string(10) "original.2"
+array(1) {
+ [0]=>
+ string(10) "original.1"
}
---TEST--\r
-Foreach loop tests - error case: not an array.\r
---FILE--\r
-<?php\r
-echo "\nNot an array.\n";\r
-$a = TRUE;\r
-foreach ($a as $v) {\r
- var_dump($v);\r
-}\r
-\r
-$a = null;\r
-foreach ($a as $v) {\r
- var_dump($v);\r
-}\r
-\r
-$a = 1;\r
-foreach ($a as $v) {\r
- var_dump($v);\r
-}\r
-\r
-$a = 1.5;\r
-foreach ($a as $v) {\r
- var_dump($v);\r
-}\r
-\r
-$a = "hello";\r
-foreach ($a as $v) {\r
- var_dump($v);\r
-}\r
-\r
-echo "done.\n";\r
-?>\r
---EXPECTF--\r
-\r
-Not an array.\r
-\r
-Warning: Invalid argument supplied for foreach() in %s on line 4\r
-\r
-Warning: Invalid argument supplied for foreach() in %s on line 9\r
-\r
-Warning: Invalid argument supplied for foreach() in %s on line 14\r
-\r
-Warning: Invalid argument supplied for foreach() in %s on line 19\r
-\r
-Warning: Invalid argument supplied for foreach() in %s on line 24\r
-done.\r
+--TEST--
+Foreach loop tests - error case: not an array.
+--FILE--
+<?php
+echo "\nNot an array.\n";
+$a = TRUE;
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+$a = null;
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+$a = 1;
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+$a = 1.5;
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+$a = "hello";
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+echo "done.\n";
+?>
+--EXPECTF--
+
+Not an array.
+
+Warning: Invalid argument supplied for foreach() in %s on line 4
+
+Warning: Invalid argument supplied for foreach() in %s on line 9
+
+Warning: Invalid argument supplied for foreach() in %s on line 14
+
+Warning: Invalid argument supplied for foreach() in %s on line 19
+
+Warning: Invalid argument supplied for foreach() in %s on line 24
+done.
---TEST--\r
-Foreach loop tests - using an array element as the $value\r
---FILE--\r
-<?php\r
-\r
-$a=array("a", "b", "c");\r
-$v=array();\r
-foreach($a as $v[0]) {\r
- var_dump($v);\r
-}\r
-var_dump($a);\r
-var_dump($v);\r
-\r
-echo "\n";\r
-$a=array("a", "b", "c");\r
-$v=array();\r
-foreach($a as $k=>$v[0]) {\r
- var_dump($k, $v);\r
-}\r
-var_dump($a);\r
-var_dump($k, $v);\r
-?>\r
---EXPECT--\r
-array(1) {\r
- [0]=>\r
- string(1) "a"\r
-}\r
-array(1) {\r
- [0]=>\r
- string(1) "b"\r
-}\r
-array(1) {\r
- [0]=>\r
- string(1) "c"\r
-}\r
-array(3) {\r
- [0]=>\r
- string(1) "a"\r
- [1]=>\r
- string(1) "b"\r
- [2]=>\r
- string(1) "c"\r
-}\r
-array(1) {\r
- [0]=>\r
- string(1) "c"\r
-}\r
-\r
-int(0)\r
-array(1) {\r
- [0]=>\r
- string(1) "a"\r
-}\r
-int(1)\r
-array(1) {\r
- [0]=>\r
- string(1) "b"\r
-}\r
-int(2)\r
-array(1) {\r
- [0]=>\r
- string(1) "c"\r
-}\r
-array(3) {\r
- [0]=>\r
- string(1) "a"\r
- [1]=>\r
- string(1) "b"\r
- [2]=>\r
- string(1) "c"\r
-}\r
-int(2)\r
-array(1) {\r
- [0]=>\r
- string(1) "c"\r
+--TEST--
+Foreach loop tests - using an array element as the $value
+--FILE--
+<?php
+
+$a=array("a", "b", "c");
+$v=array();
+foreach($a as $v[0]) {
+ var_dump($v);
+}
+var_dump($a);
+var_dump($v);
+
+echo "\n";
+$a=array("a", "b", "c");
+$v=array();
+foreach($a as $k=>$v[0]) {
+ var_dump($k, $v);
+}
+var_dump($a);
+var_dump($k, $v);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "b"
+}
+array(1) {
+ [0]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(1) {
+ [0]=>
+ string(1) "c"
+}
+
+int(0)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+int(1)
+array(1) {
+ [0]=>
+ string(1) "b"
+}
+int(2)
+array(1) {
+ [0]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+int(2)
+array(1) {
+ [0]=>
+ string(1) "c"
}
---TEST--\r
-Foreach loop tests - modifying the array during the loop: special case. Behaviour is good since php 5.2.2.\r
---FILE--\r
-<?php\r
-$a = array("original.0","original.1","original.2");\r
-foreach ($a as $k=>&$v){\r
- $a[$k] = "changed.$k";\r
- echo "After changing \$a directly, \$v@$k is: $v\n";\r
-}\r
-//--- Expected output:\r
-//After changing $a directly, $v@0 is: changed.0\r
-//After changing $a directly, $v@1 is: changed.1\r
-//After changing $a directly, $v@2 is: changed.2\r
-//--- Actual output from php.net before 5.2.2:\r
-//After changing $a directly, $v@0 is: changed.0\r
-//After changing $a directly, $v@1 is: original.1\r
-//After changing $a directly, $v@2 is: original.2\r
-\r
-?>\r
---EXPECT--\r
-After changing $a directly, $v@0 is: changed.0\r
-After changing $a directly, $v@1 is: changed.1\r
-After changing $a directly, $v@2 is: changed.2\r
+--TEST--
+Foreach loop tests - modifying the array during the loop: special case. Behaviour is good since php 5.2.2.
+--FILE--
+<?php
+$a = array("original.0","original.1","original.2");
+foreach ($a as $k=>&$v){
+ $a[$k] = "changed.$k";
+ echo "After changing \$a directly, \$v@$k is: $v\n";
+}
+//--- Expected output:
+//After changing $a directly, $v@0 is: changed.0
+//After changing $a directly, $v@1 is: changed.1
+//After changing $a directly, $v@2 is: changed.2
+//--- Actual output from php.net before 5.2.2:
+//After changing $a directly, $v@0 is: changed.0
+//After changing $a directly, $v@1 is: original.1
+//After changing $a directly, $v@2 is: original.2
+
+?>
+--EXPECT--
+After changing $a directly, $v@0 is: changed.0
+After changing $a directly, $v@1 is: changed.1
+After changing $a directly, $v@2 is: changed.2
---TEST--\r
-Foreach loop tests - error case: key is a reference.\r
---FILE--\r
-<?php\r
-$a = array("a","b","c");\r
-foreach ($a as &$k=>$v) {\r
- var_dump($v);\r
-}\r
-?>\r
---EXPECTF--\r
+--TEST--
+Foreach loop tests - error case: key is a reference.
+--FILE--
+<?php
+$a = array("a","b","c");
+foreach ($a as &$k=>$v) {
+ var_dump($v);
+}
+?>
+--EXPECTF--
Fatal error: Key element cannot be a reference in %s on line 3
---TEST--\r
-Foreach loop tests - foreach operates on the original array if the array is referenced outside the loop.\r
---FILE--\r
-<?php\r
-// From php.net/foreach:\r
-// "Unless the array is referenced, foreach operates on a copy of the specified array."\r
-\r
-echo "\nRemove elements from a referenced array during loop\n";\r
-$refedArray=array("original.0", "original.1", "original.2");\r
-$ref=&$refedArray;\r
-foreach ($refedArray as $k=>$v1) {\r
- array_pop($refedArray);\r
- echo "key: $k; value: $v1\n";\r
-}\r
-\r
-echo "\nRemove elements from a referenced array during loop, using &\$value\n";\r
-$refedArray=array("original.0", "original.1", "original.2");\r
-$ref=&$refedArray;\r
-foreach ($refedArray as $k=>&$v2) {\r
- array_pop($refedArray);\r
- echo "key: $k; value: $v2\n";\r
-}\r
-\r
-echo "\nAdd elements to a referenced array during loop\n";\r
-$refedArray=array("original.0", "original.1", "original.2");\r
-$ref=&$refedArray;\r
-$count=0;\r
-foreach ($refedArray as $k=>$v3) {\r
- array_push($refedArray, "new.$k");\r
- echo "key: $k; value: $v3\n";\r
- \r
- if ($count++>5) {\r
- echo "Loop detected, as expected.\n";\r
- break;\r
- }\r
-}\r
-\r
-echo "\nAdd elements to a referenced array during loop, using &\$value\n";\r
-$refedArray=array("original.0", "original.1", "original.2");\r
-$ref=&$refedArray;\r
-$count=0;\r
-foreach ($refedArray as $k=>&$v4) {\r
- array_push($refedArray, "new.$k");\r
- echo "key: $k; value: $v4\n";\r
- \r
- if ($count++>5) {\r
- echo "Loop detected, as expected.\n";\r
- break;\r
- }\r
-}\r
-\r
-?>\r
---EXPECT--\r
-\r
-Remove elements from a referenced array during loop\r
-key: 0; value: original.0\r
-key: 1; value: original.1\r
-key: 2; value: original.2\r
-\r
-Remove elements from a referenced array during loop, using &$value\r
-key: 0; value: original.0\r
-key: 1; value: original.1\r
-\r
-Add elements to a referenced array during loop\r
-key: 0; value: original.0\r
-key: 1; value: original.1\r
-key: 2; value: original.2\r
-\r
-Add elements to a referenced array during loop, using &$value\r
-key: 0; value: original.0\r
-key: 1; value: original.1\r
-key: 2; value: original.2\r
-key: 3; value: new.0\r
-key: 4; value: new.1\r
-key: 5; value: new.2\r
-key: 6; value: new.3\r
-Loop detected, as expected.\r
-\r
+--TEST--
+Foreach loop tests - foreach operates on the original array if the array is referenced outside the loop.
+--FILE--
+<?php
+// From php.net/foreach:
+// "Unless the array is referenced, foreach operates on a copy of the specified array."
+
+echo "\nRemove elements from a referenced array during loop\n";
+$refedArray=array("original.0", "original.1", "original.2");
+$ref=&$refedArray;
+foreach ($refedArray as $k=>$v1) {
+ array_pop($refedArray);
+ echo "key: $k; value: $v1\n";
+}
+
+echo "\nRemove elements from a referenced array during loop, using &\$value\n";
+$refedArray=array("original.0", "original.1", "original.2");
+$ref=&$refedArray;
+foreach ($refedArray as $k=>&$v2) {
+ array_pop($refedArray);
+ echo "key: $k; value: $v2\n";
+}
+
+echo "\nAdd elements to a referenced array during loop\n";
+$refedArray=array("original.0", "original.1", "original.2");
+$ref=&$refedArray;
+$count=0;
+foreach ($refedArray as $k=>$v3) {
+ array_push($refedArray, "new.$k");
+ echo "key: $k; value: $v3\n";
+
+ if ($count++>5) {
+ echo "Loop detected, as expected.\n";
+ break;
+ }
+}
+
+echo "\nAdd elements to a referenced array during loop, using &\$value\n";
+$refedArray=array("original.0", "original.1", "original.2");
+$ref=&$refedArray;
+$count=0;
+foreach ($refedArray as $k=>&$v4) {
+ array_push($refedArray, "new.$k");
+ echo "key: $k; value: $v4\n";
+
+ if ($count++>5) {
+ echo "Loop detected, as expected.\n";
+ break;
+ }
+}
+
+?>
+--EXPECT--
+
+Remove elements from a referenced array during loop
+key: 0; value: original.0
+key: 1; value: original.1
+key: 2; value: original.2
+
+Remove elements from a referenced array during loop, using &$value
+key: 0; value: original.0
+key: 1; value: original.1
+
+Add elements to a referenced array during loop
+key: 0; value: original.0
+key: 1; value: original.1
+key: 2; value: original.2
+
+Add elements to a referenced array during loop, using &$value
+key: 0; value: original.0
+key: 1; value: original.1
+key: 2; value: original.2
+key: 3; value: new.0
+key: 4; value: new.1
+key: 5; value: new.2
+key: 6; value: new.3
+Loop detected, as expected.
+
---TEST--\r
-This test illustrates the impact of invoking destructors when refcount is decremented to 0 on foreach.\r
-It will pass only if the 'contentious code' in PHPValue.decReferences() is enabled.\r
---FILE--\r
-<?php\r
-\r
-$a = array(1,2,3);\r
-$container = array(&$a);\r
-\r
-// From php.net: \r
-// "Unless the array is referenced, foreach operates on a copy of\r
-// the specified array and not the array itself."\r
-// At this point, the array $a is referenced.\r
-\r
-// The following line ensures $a is no longer references as a consequence\r
-// of running the 'destructor' on $container. \r
-$container = null;\r
-\r
-// At this point the array $a is no longer referenced, so foreach should operate on a copy of the array.\r
-// However, P8 does not invoke 'destructors' when refcount is decremented to 0.\r
-// Consequently, $a thinks it is still referenced, and foreach will operate on the array itself.\r
-// This provokes a difference in behaviour when changing the number of elements in the array while\r
-// iterating over it. \r
-\r
-$i=0;\r
-foreach ($a as $v) {\r
- array_push($a, 'new');\r
- var_dump($v);\r
- \r
- if (++$i>10) {\r
- echo "Infinite loop detected\n";\r
- break;\r
- }\r
-}\r
-\r
-?>\r
---EXPECTF--\r
-int(1)\r
-int(2)\r
+--TEST--
+This test illustrates the impact of invoking destructors when refcount is decremented to 0 on foreach.
+It will pass only if the 'contentious code' in PHPValue.decReferences() is enabled.
+--FILE--
+<?php
+
+$a = array(1,2,3);
+$container = array(&$a);
+
+// From php.net:
+// "Unless the array is referenced, foreach operates on a copy of
+// the specified array and not the array itself."
+// At this point, the array $a is referenced.
+
+// The following line ensures $a is no longer references as a consequence
+// of running the 'destructor' on $container.
+$container = null;
+
+// At this point the array $a is no longer referenced, so foreach should operate on a copy of the array.
+// However, P8 does not invoke 'destructors' when refcount is decremented to 0.
+// Consequently, $a thinks it is still referenced, and foreach will operate on the array itself.
+// This provokes a difference in behaviour when changing the number of elements in the array while
+// iterating over it.
+
+$i=0;
+foreach ($a as $v) {
+ array_push($a, 'new');
+ var_dump($v);
+
+ if (++$i>10) {
+ echo "Infinite loop detected\n";
+ break;
+ }
+}
+
+?>
+--EXPECTF--
+int(1)
+int(2)
int(3)
---TEST-- \r
-Changing from an interable type to a non iterable type during the iteration \r
---FILE--\r
-<?php\r
-echo "\nChange from array to non iterable:\n";\r
-$a = array(1,2,3);\r
-$b=&$a;\r
-foreach ($a as $v) {\r
- var_dump($v);\r
- $b=1;\r
-}\r
-\r
-echo "\nChange from object to non iterable:\n";\r
-$a = new stdClass;\r
-$a->a=1;\r
-$a->b=2;\r
-$b=&$a;\r
-foreach ($a as $v) {\r
- var_dump($v);\r
- $b='x'; \r
-}\r
-\r
-?>\r
---EXPECTF--\r
-\r
-Change from array to non iterable:\r
-int(1)\r
-int(2)\r
-int(3)\r
-\r
-Change from object to non iterable:\r
-int(1)\r
-int(2)\r
+--TEST--
+Changing from an interable type to a non iterable type during the iteration
+--FILE--
+<?php
+echo "\nChange from array to non iterable:\n";
+$a = array(1,2,3);
+$b=&$a;
+foreach ($a as $v) {
+ var_dump($v);
+ $b=1;
+}
+
+echo "\nChange from object to non iterable:\n";
+$a = new stdClass;
+$a->a=1;
+$a->b=2;
+$b=&$a;
+foreach ($a as $v) {
+ var_dump($v);
+ $b='x';
+}
+
+?>
+--EXPECTF--
+
+Change from array to non iterable:
+int(1)
+int(2)
+int(3)
+
+Change from object to non iterable:
+int(1)
+int(2)
---TEST--\r
-Directly modifying an unreferenced array when foreach'ing over it.\r
---FILE--\r
-<?php\r
-\r
-define('MAX_LOOPS',5);\r
-\r
-function withRefValue($elements, $transform) {\r
- echo "\n---( Array with $elements element(s): )---\n";\r
- //Build array:\r
- for ($i=0; $i<$elements; $i++) {\r
- $a[] = "v.$i";\r
- }\r
- $counter=0;\r
- \r
- echo "--> State of array before loop:\n";\r
- var_dump($a);\r
- \r
- echo "--> Do loop:\n"; \r
- foreach ($a as $k=>$v) {\r
- echo " iteration $counter: \$k=$k; \$v=$v\n";\r
- eval($transform);\r
- $counter++;\r
- if ($counter>MAX_LOOPS) {\r
- echo " ** Stuck in a loop! **\n";\r
- break;\r
- }\r
- }\r
- \r
- echo "--> State of array after loop:\n";\r
- var_dump($a);\r
-}\r
-\r
-\r
-echo "\nPopping elements off end of an unreferenced array";\r
-$transform = 'array_pop($a);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nShift elements off start of an unreferenced array";\r
-$transform = 'array_shift($a);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nRemove current element of an unreferenced array";\r
-$transform = 'unset($a[$k]);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nAdding elements to the end of an unreferenced array";\r
-$transform = 'array_push($a, "new.$counter");';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nAdding elements to the start of an unreferenced array";\r
-$transform = 'array_unshift($a, "new.$counter");';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-?>\r
---EXPECTF--\r
-\r
-Popping elements off end of an unreferenced array\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Shift elements off start of an unreferenced array\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Remove current element of an unreferenced array\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Adding elements to the end of an unreferenced array\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(5) "new.0"\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(5) "new.0"\r
- [3]=>\r
- string(5) "new.1"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(6) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(5) "new.0"\r
- [4]=>\r
- string(5) "new.1"\r
- [5]=>\r
- string(5) "new.2"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(8) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
- [4]=>\r
- string(5) "new.0"\r
- [5]=>\r
- string(5) "new.1"\r
- [6]=>\r
- string(5) "new.2"\r
- [7]=>\r
- string(5) "new.3"\r
-}\r
-\r
-\r
-\r
-Adding elements to the start of an unreferenced array\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(2) {\r
- [0]=>\r
- string(5) "new.0"\r
- [1]=>\r
- string(3) "v.0"\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(4) {\r
- [0]=>\r
- string(5) "new.1"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(3) "v.0"\r
- [3]=>\r
- string(3) "v.1"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(6) {\r
- [0]=>\r
- string(5) "new.2"\r
- [1]=>\r
- string(5) "new.1"\r
- [2]=>\r
- string(5) "new.0"\r
- [3]=>\r
- string(3) "v.0"\r
- [4]=>\r
- string(3) "v.1"\r
- [5]=>\r
- string(3) "v.2"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(8) {\r
- [0]=>\r
- string(5) "new.3"\r
- [1]=>\r
- string(5) "new.2"\r
- [2]=>\r
- string(5) "new.1"\r
- [3]=>\r
- string(5) "new.0"\r
- [4]=>\r
- string(3) "v.0"\r
- [5]=>\r
- string(3) "v.1"\r
- [6]=>\r
- string(3) "v.2"\r
- [7]=>\r
- string(3) "v.3"\r
-}\r
+--TEST--
+Directly modifying an unreferenced array when foreach'ing over it.
+--FILE--
+<?php
+
+define('MAX_LOOPS',5);
+
+function withRefValue($elements, $transform) {
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ echo "--> State of array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
+}
+
+
+echo "\nPopping elements off end of an unreferenced array";
+$transform = 'array_pop($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nShift elements off start of an unreferenced array";
+$transform = 'array_shift($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nRemove current element of an unreferenced array";
+$transform = 'unset($a[$k]);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the end of an unreferenced array";
+$transform = 'array_push($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the start of an unreferenced array";
+$transform = 'array_unshift($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+?>
+--EXPECTF--
+
+Popping elements off end of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Shift elements off start of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Remove current element of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Adding elements to the end of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(5) "new.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(5) "new.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(6) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+ [4]=>
+ string(5) "new.0"
+ [5]=>
+ string(5) "new.1"
+ [6]=>
+ string(5) "new.2"
+ [7]=>
+ string(5) "new.3"
+}
+
+
+
+Adding elements to the start of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(5) "new.0"
+ [1]=>
+ string(3) "v.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(4) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ string(3) "v.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(6) {
+ [0]=>
+ string(5) "new.2"
+ [1]=>
+ string(5) "new.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(3) "v.0"
+ [4]=>
+ string(3) "v.1"
+ [5]=>
+ string(3) "v.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(5) "new.3"
+ [1]=>
+ string(5) "new.2"
+ [2]=>
+ string(5) "new.1"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(3) "v.0"
+ [5]=>
+ string(3) "v.1"
+ [6]=>
+ string(3) "v.2"
+ [7]=>
+ string(3) "v.3"
+}
---TEST--\r
-Directly modifying an unreferenced array when foreach'ing over it while using &$value syntax.\r
---FILE--\r
-<?php\r
-\r
-define('MAX_LOOPS',5);\r
-\r
-function withRefValue($elements, $transform) {\r
- echo "\n---( Array with $elements element(s): )---\n";\r
- //Build array:\r
- for ($i=0; $i<$elements; $i++) {\r
- $a[] = "v.$i";\r
- }\r
- $counter=0;\r
- \r
- echo "--> State of array before loop:\n";\r
- var_dump($a);\r
- \r
- echo "--> Do loop:\n"; \r
- foreach ($a as $k=>&$v) {\r
- echo " iteration $counter: \$k=$k; \$v=$v\n";\r
- eval($transform);\r
- $counter++;\r
- if ($counter>MAX_LOOPS) {\r
- echo " ** Stuck in a loop! **\n";\r
- break;\r
- }\r
- }\r
- \r
- echo "--> State of array after loop:\n";\r
- var_dump($a);\r
-}\r
-\r
-\r
-echo "\nPopping elements off end of an unreferenced array, using &\$value.";\r
-$transform = 'array_pop($a);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nShift elements off start of an unreferenced array, using &\$value.";\r
-$transform = 'array_shift($a);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nRemove current element of an unreferenced array, using &\$value.";\r
-$transform = 'unset($a[$k]);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nAdding elements to the end of an unreferenced array, using &\$value.";\r
-$transform = 'array_push($a, "new.$counter");';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nAdding elements to the start of an unreferenced array, using &\$value.";\r
-$transform = 'array_unshift($a, "new.$counter");';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-?>\r
---EXPECT--\r
-\r
-Popping elements off end of an unreferenced array, using &$value.\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(1) {\r
- [0]=>\r
- &string(3) "v.0"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- &string(3) "v.1"\r
-}\r
-\r
-\r
-\r
-Shift elements off start of an unreferenced array, using &$value.\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=0; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=0; $v=v.1\r
- iteration 2: $k=0; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=0; $v=v.1\r
- iteration 2: $k=0; $v=v.2\r
- iteration 3: $k=0; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Remove current element of an unreferenced array, using &$value.\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Adding elements to the end of an unreferenced array, using &$value.\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=new.0\r
- iteration 2: $k=2; $v=new.1\r
- iteration 3: $k=3; $v=new.2\r
- iteration 4: $k=4; $v=new.3\r
- iteration 5: $k=5; $v=new.4\r
- ** Stuck in a loop! **\r
---> State of array after loop:\r
-array(7) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(5) "new.1"\r
- [3]=>\r
- string(5) "new.2"\r
- [4]=>\r
- string(5) "new.3"\r
- [5]=>\r
- &string(5) "new.4"\r
- [6]=>\r
- string(5) "new.5"\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=new.0\r
- iteration 3: $k=3; $v=new.1\r
- iteration 4: $k=4; $v=new.2\r
- iteration 5: $k=5; $v=new.3\r
- ** Stuck in a loop! **\r
---> State of array after loop:\r
-array(8) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(5) "new.0"\r
- [3]=>\r
- string(5) "new.1"\r
- [4]=>\r
- string(5) "new.2"\r
- [5]=>\r
- &string(5) "new.3"\r
- [6]=>\r
- string(5) "new.4"\r
- [7]=>\r
- string(5) "new.5"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=new.0\r
- iteration 4: $k=4; $v=new.1\r
- iteration 5: $k=5; $v=new.2\r
- ** Stuck in a loop! **\r
---> State of array after loop:\r
-array(9) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(5) "new.0"\r
- [4]=>\r
- string(5) "new.1"\r
- [5]=>\r
- &string(5) "new.2"\r
- [6]=>\r
- string(5) "new.3"\r
- [7]=>\r
- string(5) "new.4"\r
- [8]=>\r
- string(5) "new.5"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
- iteration 4: $k=4; $v=new.0\r
- iteration 5: $k=5; $v=new.1\r
- ** Stuck in a loop! **\r
---> State of array after loop:\r
-array(10) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
- [4]=>\r
- string(5) "new.0"\r
- [5]=>\r
- &string(5) "new.1"\r
- [6]=>\r
- string(5) "new.2"\r
- [7]=>\r
- string(5) "new.3"\r
- [8]=>\r
- string(5) "new.4"\r
- [9]=>\r
- string(5) "new.5"\r
-}\r
-\r
-\r
-\r
-Adding elements to the start of an unreferenced array, using &$value.\r
----( Array with 1 element(s): )---\r
---> State of array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(2) {\r
- [0]=>\r
- string(5) "new.0"\r
- [1]=>\r
- &string(3) "v.0"\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=2; $v=v.1\r
---> State of array after loop:\r
-array(4) {\r
- [0]=>\r
- string(5) "new.1"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(3) "v.0"\r
- [3]=>\r
- &string(3) "v.1"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=3; $v=v.2\r
---> State of array after loop:\r
-array(5) {\r
- [0]=>\r
- string(5) "new.1"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(3) "v.0"\r
- [3]=>\r
- string(3) "v.1"\r
- [4]=>\r
- &string(3) "v.2"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=4; $v=v.3\r
---> State of array after loop:\r
-array(6) {\r
- [0]=>\r
- string(5) "new.1"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(3) "v.0"\r
- [3]=>\r
- string(3) "v.1"\r
- [4]=>\r
- string(3) "v.2"\r
- [5]=>\r
- &string(3) "v.3"\r
-}\r
+--TEST--
+Directly modifying an unreferenced array when foreach'ing over it while using &$value syntax.
+--FILE--
+<?php
+
+define('MAX_LOOPS',5);
+
+function withRefValue($elements, $transform) {
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ echo "--> State of array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>&$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
+}
+
+
+echo "\nPopping elements off end of an unreferenced array, using &\$value.";
+$transform = 'array_pop($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nShift elements off start of an unreferenced array, using &\$value.";
+$transform = 'array_shift($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nRemove current element of an unreferenced array, using &\$value.";
+$transform = 'unset($a[$k]);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the end of an unreferenced array, using &\$value.";
+$transform = 'array_push($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the start of an unreferenced array, using &\$value.";
+$transform = 'array_unshift($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+?>
+--EXPECT--
+
+Popping elements off end of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(1) {
+ [0]=>
+ &string(3) "v.0"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ &string(3) "v.1"
+}
+
+
+
+Shift elements off start of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+ iteration 3: $k=0; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Remove current element of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Adding elements to the end of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=new.0
+ iteration 2: $k=2; $v=new.1
+ iteration 3: $k=3; $v=new.2
+ iteration 4: $k=4; $v=new.3
+ iteration 5: $k=5; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(7) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(5) "new.1"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.3"
+ [5]=>
+ &string(5) "new.4"
+ [6]=>
+ string(5) "new.5"
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=new.0
+ iteration 3: $k=3; $v=new.1
+ iteration 4: $k=4; $v=new.2
+ iteration 5: $k=5; $v=new.3
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(5) "new.1"
+ [4]=>
+ string(5) "new.2"
+ [5]=>
+ &string(5) "new.3"
+ [6]=>
+ string(5) "new.4"
+ [7]=>
+ string(5) "new.5"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=new.0
+ iteration 4: $k=4; $v=new.1
+ iteration 5: $k=5; $v=new.2
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(9) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ &string(5) "new.2"
+ [6]=>
+ string(5) "new.3"
+ [7]=>
+ string(5) "new.4"
+ [8]=>
+ string(5) "new.5"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+ iteration 4: $k=4; $v=new.0
+ iteration 5: $k=5; $v=new.1
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(10) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+ [4]=>
+ string(5) "new.0"
+ [5]=>
+ &string(5) "new.1"
+ [6]=>
+ string(5) "new.2"
+ [7]=>
+ string(5) "new.3"
+ [8]=>
+ string(5) "new.4"
+ [9]=>
+ string(5) "new.5"
+}
+
+
+
+Adding elements to the start of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(5) "new.0"
+ [1]=>
+ &string(3) "v.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=2; $v=v.1
+--> State of array after loop:
+array(4) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ &string(3) "v.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=3; $v=v.2
+--> State of array after loop:
+array(5) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ string(3) "v.1"
+ [4]=>
+ &string(3) "v.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=4; $v=v.3
+--> State of array after loop:
+array(6) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ string(3) "v.1"
+ [4]=>
+ string(3) "v.2"
+ [5]=>
+ &string(3) "v.3"
+}
---TEST--\r
-Directly modifying a REFERENCED array when foreach'ing over it.\r
---FILE--\r
-<?php\r
-\r
-define('MAX_LOOPS',5);\r
-\r
-function withRefValue($elements, $transform) {\r
- echo "\n---( Array with $elements element(s): )---\n";\r
- //Build array:\r
- for ($i=0; $i<$elements; $i++) {\r
- $a[] = "v.$i";\r
- }\r
- $counter=0;\r
- \r
- $ref = &$a;\r
- \r
- echo "--> State of referenced array before loop:\n";\r
- var_dump($a);\r
- \r
- echo "--> Do loop:\n"; \r
- foreach ($a as $k=>$v) {\r
- echo " iteration $counter: \$k=$k; \$v=$v\n";\r
- eval($transform);\r
- $counter++;\r
- if ($counter>MAX_LOOPS) {\r
- echo " ** Stuck in a loop! **\n";\r
- break;\r
- }\r
- }\r
- \r
- echo "--> State of array after loop:\n";\r
- var_dump($a);\r
-}\r
-\r
-\r
-echo "\nPopping elements off end of a referenced array";\r
-$transform = 'array_pop($a);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nShift elements off start of a referenced array";\r
-$transform = 'array_shift($a);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nRemove current element of a referenced array";\r
-$transform = 'unset($a[$k]);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nAdding elements to the end of a referenced array";\r
-$transform = 'array_push($a, "new.$counter");';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nAdding elements to the start of a referenced array";\r
-$transform = 'array_unshift($a, "new.$counter");';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-?>\r
---EXPECTF--\r
-Popping elements off end of a referenced array\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Shift elements off start of a referenced array\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Remove current element of a referenced array\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Adding elements to the end of a referenced array\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(5) "new.0"\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(5) "new.0"\r
- [3]=>\r
- string(5) "new.1"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(6) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(5) "new.0"\r
- [4]=>\r
- string(5) "new.1"\r
- [5]=>\r
- string(5) "new.2"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(8) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
- [4]=>\r
- string(5) "new.0"\r
- [5]=>\r
- string(5) "new.1"\r
- [6]=>\r
- string(5) "new.2"\r
- [7]=>\r
- string(5) "new.3"\r
-}\r
-\r
-\r
-\r
-Adding elements to the start of a referenced array\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(2) {\r
- [0]=>\r
- string(5) "new.0"\r
- [1]=>\r
- string(3) "v.0"\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(4) {\r
- [0]=>\r
- string(5) "new.1"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(3) "v.0"\r
- [3]=>\r
- string(3) "v.1"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(6) {\r
- [0]=>\r
- string(5) "new.2"\r
- [1]=>\r
- string(5) "new.1"\r
- [2]=>\r
- string(5) "new.0"\r
- [3]=>\r
- string(3) "v.0"\r
- [4]=>\r
- string(3) "v.1"\r
- [5]=>\r
- string(3) "v.2"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(8) {\r
- [0]=>\r
- string(5) "new.3"\r
- [1]=>\r
- string(5) "new.2"\r
- [2]=>\r
- string(5) "new.1"\r
- [3]=>\r
- string(5) "new.0"\r
- [4]=>\r
- string(3) "v.0"\r
- [5]=>\r
- string(3) "v.1"\r
- [6]=>\r
- string(3) "v.2"\r
- [7]=>\r
- string(3) "v.3"\r
-}\r
+--TEST--
+Directly modifying a REFERENCED array when foreach'ing over it.
+--FILE--
+<?php
+
+define('MAX_LOOPS',5);
+
+function withRefValue($elements, $transform) {
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ $ref = &$a;
+
+ echo "--> State of referenced array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
+}
+
+
+echo "\nPopping elements off end of a referenced array";
+$transform = 'array_pop($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nShift elements off start of a referenced array";
+$transform = 'array_shift($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nRemove current element of a referenced array";
+$transform = 'unset($a[$k]);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the end of a referenced array";
+$transform = 'array_push($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the start of a referenced array";
+$transform = 'array_unshift($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+?>
+--EXPECTF--
+Popping elements off end of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Shift elements off start of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Remove current element of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Adding elements to the end of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(5) "new.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(5) "new.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(6) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+ [4]=>
+ string(5) "new.0"
+ [5]=>
+ string(5) "new.1"
+ [6]=>
+ string(5) "new.2"
+ [7]=>
+ string(5) "new.3"
+}
+
+
+
+Adding elements to the start of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(5) "new.0"
+ [1]=>
+ string(3) "v.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(4) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ string(3) "v.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(6) {
+ [0]=>
+ string(5) "new.2"
+ [1]=>
+ string(5) "new.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(3) "v.0"
+ [4]=>
+ string(3) "v.1"
+ [5]=>
+ string(3) "v.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(5) "new.3"
+ [1]=>
+ string(5) "new.2"
+ [2]=>
+ string(5) "new.1"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(3) "v.0"
+ [5]=>
+ string(3) "v.1"
+ [6]=>
+ string(3) "v.2"
+ [7]=>
+ string(3) "v.3"
+}
---TEST--\r
-Directly modifying a REFERENCED array when foreach'ing over it while using &$value syntax.\r
---FILE--\r
-<?php\r
-\r
-define('MAX_LOOPS',5);\r
-\r
-function withRefValue($elements, $transform) {\r
- echo "\n---( Array with $elements element(s): )---\n";\r
- //Build array:\r
- for ($i=0; $i<$elements; $i++) {\r
- $a[] = "v.$i";\r
- }\r
- $counter=0;\r
- \r
- $ref = &$a;\r
- \r
- echo "--> State of referenced array before loop:\n";\r
- var_dump($a);\r
- \r
- echo "--> Do loop:\n"; \r
- foreach ($a as $k=>&$v) {\r
- echo " iteration $counter: \$k=$k; \$v=$v\n";\r
- eval($transform);\r
- $counter++;\r
- if ($counter>MAX_LOOPS) {\r
- echo " ** Stuck in a loop! **\n";\r
- break;\r
- }\r
- }\r
- \r
- echo "--> State of array after loop:\n";\r
- var_dump($a);\r
-}\r
-\r
-\r
-echo "\nPopping elements off end of a referenced array, using &\$value";\r
-$transform = 'array_pop($a);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nShift elements off start of a referenced array, using &\$value";\r
-$transform = 'array_shift($a);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nRemove current element of a referenced array, using &\$value";\r
-$transform = 'unset($a[$k]);';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nAdding elements to the end of a referenced array, using &\$value";\r
-$transform = 'array_push($a, "new.$counter");';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-echo "\n\n\nAdding elements to the start of a referenced array, using &\$value";\r
-$transform = 'array_unshift($a, "new.$counter");';\r
-withRefValue(1, $transform);\r
-withRefValue(2, $transform);\r
-withRefValue(3, $transform);\r
-withRefValue(4, $transform);\r
-\r
-?>\r
---EXPECT--\r
-\r
-Popping elements off end of a referenced array, using &$value\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(1) {\r
- [0]=>\r
- &string(3) "v.0"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- &string(3) "v.1"\r
-}\r
-\r
-\r
-\r
-Shift elements off start of a referenced array, using &$value\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=0; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=0; $v=v.1\r
- iteration 2: $k=0; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=0; $v=v.1\r
- iteration 2: $k=0; $v=v.2\r
- iteration 3: $k=0; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Remove current element of a referenced array, using &$value\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
---> State of array after loop:\r
-array(0) {\r
-}\r
-\r
-\r
-\r
-Adding elements to the end of a referenced array, using &$value\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=new.0\r
- iteration 2: $k=2; $v=new.1\r
- iteration 3: $k=3; $v=new.2\r
- iteration 4: $k=4; $v=new.3\r
- iteration 5: $k=5; $v=new.4\r
- ** Stuck in a loop! **\r
---> State of array after loop:\r
-array(7) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(5) "new.1"\r
- [3]=>\r
- string(5) "new.2"\r
- [4]=>\r
- string(5) "new.3"\r
- [5]=>\r
- &string(5) "new.4"\r
- [6]=>\r
- string(5) "new.5"\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=new.0\r
- iteration 3: $k=3; $v=new.1\r
- iteration 4: $k=4; $v=new.2\r
- iteration 5: $k=5; $v=new.3\r
- ** Stuck in a loop! **\r
---> State of array after loop:\r
-array(8) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(5) "new.0"\r
- [3]=>\r
- string(5) "new.1"\r
- [4]=>\r
- string(5) "new.2"\r
- [5]=>\r
- &string(5) "new.3"\r
- [6]=>\r
- string(5) "new.4"\r
- [7]=>\r
- string(5) "new.5"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=new.0\r
- iteration 4: $k=4; $v=new.1\r
- iteration 5: $k=5; $v=new.2\r
- ** Stuck in a loop! **\r
---> State of array after loop:\r
-array(9) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(5) "new.0"\r
- [4]=>\r
- string(5) "new.1"\r
- [5]=>\r
- &string(5) "new.2"\r
- [6]=>\r
- string(5) "new.3"\r
- [7]=>\r
- string(5) "new.4"\r
- [8]=>\r
- string(5) "new.5"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=1; $v=v.1\r
- iteration 2: $k=2; $v=v.2\r
- iteration 3: $k=3; $v=v.3\r
- iteration 4: $k=4; $v=new.0\r
- iteration 5: $k=5; $v=new.1\r
- ** Stuck in a loop! **\r
---> State of array after loop:\r
-array(10) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
- [4]=>\r
- string(5) "new.0"\r
- [5]=>\r
- &string(5) "new.1"\r
- [6]=>\r
- string(5) "new.2"\r
- [7]=>\r
- string(5) "new.3"\r
- [8]=>\r
- string(5) "new.4"\r
- [9]=>\r
- string(5) "new.5"\r
-}\r
-\r
-\r
-\r
-Adding elements to the start of a referenced array, using &$value\r
----( Array with 1 element(s): )---\r
---> State of referenced array before loop:\r
-array(1) {\r
- [0]=>\r
- string(3) "v.0"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
---> State of array after loop:\r
-array(2) {\r
- [0]=>\r
- string(5) "new.0"\r
- [1]=>\r
- &string(3) "v.0"\r
-}\r
-\r
----( Array with 2 element(s): )---\r
---> State of referenced array before loop:\r
-array(2) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=2; $v=v.1\r
---> State of array after loop:\r
-array(4) {\r
- [0]=>\r
- string(5) "new.1"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(3) "v.0"\r
- [3]=>\r
- &string(3) "v.1"\r
-}\r
-\r
----( Array with 3 element(s): )---\r
---> State of referenced array before loop:\r
-array(3) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=3; $v=v.2\r
---> State of array after loop:\r
-array(5) {\r
- [0]=>\r
- string(5) "new.1"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(3) "v.0"\r
- [3]=>\r
- string(3) "v.1"\r
- [4]=>\r
- &string(3) "v.2"\r
-}\r
-\r
----( Array with 4 element(s): )---\r
---> State of referenced array before loop:\r
-array(4) {\r
- [0]=>\r
- string(3) "v.0"\r
- [1]=>\r
- string(3) "v.1"\r
- [2]=>\r
- string(3) "v.2"\r
- [3]=>\r
- string(3) "v.3"\r
-}\r
---> Do loop:\r
- iteration 0: $k=0; $v=v.0\r
- iteration 1: $k=4; $v=v.3\r
---> State of array after loop:\r
-array(6) {\r
- [0]=>\r
- string(5) "new.1"\r
- [1]=>\r
- string(5) "new.0"\r
- [2]=>\r
- string(3) "v.0"\r
- [3]=>\r
- string(3) "v.1"\r
- [4]=>\r
- string(3) "v.2"\r
- [5]=>\r
- &string(3) "v.3"\r
-}\r
+--TEST--
+Directly modifying a REFERENCED array when foreach'ing over it while using &$value syntax.
+--FILE--
+<?php
+
+define('MAX_LOOPS',5);
+
+function withRefValue($elements, $transform) {
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ $ref = &$a;
+
+ echo "--> State of referenced array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>&$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
+}
+
+
+echo "\nPopping elements off end of a referenced array, using &\$value";
+$transform = 'array_pop($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nShift elements off start of a referenced array, using &\$value";
+$transform = 'array_shift($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nRemove current element of a referenced array, using &\$value";
+$transform = 'unset($a[$k]);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the end of a referenced array, using &\$value";
+$transform = 'array_push($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the start of a referenced array, using &\$value";
+$transform = 'array_unshift($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+?>
+--EXPECT--
+
+Popping elements off end of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(1) {
+ [0]=>
+ &string(3) "v.0"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ &string(3) "v.1"
+}
+
+
+
+Shift elements off start of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+ iteration 3: $k=0; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Remove current element of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Adding elements to the end of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=new.0
+ iteration 2: $k=2; $v=new.1
+ iteration 3: $k=3; $v=new.2
+ iteration 4: $k=4; $v=new.3
+ iteration 5: $k=5; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(7) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(5) "new.1"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.3"
+ [5]=>
+ &string(5) "new.4"
+ [6]=>
+ string(5) "new.5"
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=new.0
+ iteration 3: $k=3; $v=new.1
+ iteration 4: $k=4; $v=new.2
+ iteration 5: $k=5; $v=new.3
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(5) "new.1"
+ [4]=>
+ string(5) "new.2"
+ [5]=>
+ &string(5) "new.3"
+ [6]=>
+ string(5) "new.4"
+ [7]=>
+ string(5) "new.5"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=new.0
+ iteration 4: $k=4; $v=new.1
+ iteration 5: $k=5; $v=new.2
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(9) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ &string(5) "new.2"
+ [6]=>
+ string(5) "new.3"
+ [7]=>
+ string(5) "new.4"
+ [8]=>
+ string(5) "new.5"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+ iteration 4: $k=4; $v=new.0
+ iteration 5: $k=5; $v=new.1
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(10) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+ [4]=>
+ string(5) "new.0"
+ [5]=>
+ &string(5) "new.1"
+ [6]=>
+ string(5) "new.2"
+ [7]=>
+ string(5) "new.3"
+ [8]=>
+ string(5) "new.4"
+ [9]=>
+ string(5) "new.5"
+}
+
+
+
+Adding elements to the start of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(5) "new.0"
+ [1]=>
+ &string(3) "v.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=2; $v=v.1
+--> State of array after loop:
+array(4) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ &string(3) "v.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=3; $v=v.2
+--> State of array after loop:
+array(5) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ string(3) "v.1"
+ [4]=>
+ &string(3) "v.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=4; $v=v.3
+--> State of array after loop:
+array(6) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ string(3) "v.1"
+ [4]=>
+ string(3) "v.2"
+ [5]=>
+ &string(3) "v.3"
+}
---TEST--\r
-Ensure foreach splits the iterated entity from its cow reference set, for all sorts of iterated entities.\r
---FILE--\r
-<?php\r
- error_reporting(E_ALL & ~E_STRICT);\r
-\r
- echo "\n" . '$a' . "\n";\r
- $b = $a = array('original');\r
- foreach($a as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '${\'a\'}' . "\n";\r
- $b = $a = array('original');\r
- foreach(${'a'} as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '$$a' . "\n";\r
- $a = 'blah';\r
- $$a = array('original');\r
- $b = $$a;\r
- foreach($$a as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '$a[0]' . "\n";\r
- $b = $a[0] = array('original');\r
- foreach($a[0] as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '$a[0][0]' . "\n";\r
- $b = $a[0][0] = array('original');\r
- foreach($a[0][0] as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '$a->b' . "\n";\r
- $b = $a->b = array('original');\r
- foreach($a->b as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '$a->b->c' . "\n";\r
- $b = $a->b->c = array('original');\r
- foreach($a->b as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '$a->b[0]' . "\n";\r
- $b = $a->b[0] = array('original');\r
- foreach($a->b[0] as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '$a->b[0][0]' . "\n";\r
- $b = $a->b[0][0] = array('original');\r
- foreach($a->b[0][0] as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . '$a->b[0]->c' . "\n";\r
- $b = $a->b[0]->c = array('original');\r
- foreach($a->b[0]->c as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- class C {\r
- public static $a;\r
- }\r
- \r
- echo "\n" . 'C::$a' . "\n";\r
- C::$a = array('original');\r
- $b = C::$a;\r
- foreach(C::$a as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset($a, $b);\r
- \r
- echo "\n" . 'C::$a[0]' . "\n";\r
- C::$a[0] = array('original');\r
- $b = C::$a[0];\r
- foreach(C::$a[0] as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset(C::$a[0], $b);\r
- \r
- echo "\n" . 'C::$a[0]->b' . "\n";\r
- C::$a[0]->b = array('original');\r
- $b = C::$a[0]->b;\r
- foreach(C::$a[0]->b as $k=>&$v) {\r
- $v = 'changed';\r
- }\r
- var_dump($b);\r
- unset(C::$a[0]->b, $b);\r
-?>\r
---EXPECTF--\r
-\r
-$a\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-${'a'}\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-$$a\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-$a[0]\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-$a[0][0]\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-$a->b\r
-\r
-Warning: Creating default object from empty value in %s on line %d\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-$a->b->c\r
-\r
-Warning: Creating default object from empty value in %s on line %d\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-$a->b[0]\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-$a->b[0][0]\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-$a->b[0]->c\r
-\r
-Warning: Creating default object from empty value in %s on line %d\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-C::$a\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-C::$a[0]\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
-\r
-C::$a[0]->b\r
-\r
-Warning: Creating default object from empty value in %s on line %d\r
-array(1) {\r
- [0]=>\r
- string(8) "original"\r
-}\r
+--TEST--
+Ensure foreach splits the iterated entity from its cow reference set, for all sorts of iterated entities.
+--FILE--
+<?php
+ error_reporting(E_ALL & ~E_STRICT);
+
+ echo "\n" . '$a' . "\n";
+ $b = $a = array('original');
+ foreach($a as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '${\'a\'}' . "\n";
+ $b = $a = array('original');
+ foreach(${'a'} as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$$a' . "\n";
+ $a = 'blah';
+ $$a = array('original');
+ $b = $$a;
+ foreach($$a as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a[0]' . "\n";
+ $b = $a[0] = array('original');
+ foreach($a[0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a[0][0]' . "\n";
+ $b = $a[0][0] = array('original');
+ foreach($a[0][0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b' . "\n";
+ $b = $a->b = array('original');
+ foreach($a->b as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b->c' . "\n";
+ $b = $a->b->c = array('original');
+ foreach($a->b as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b[0]' . "\n";
+ $b = $a->b[0] = array('original');
+ foreach($a->b[0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b[0][0]' . "\n";
+ $b = $a->b[0][0] = array('original');
+ foreach($a->b[0][0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b[0]->c' . "\n";
+ $b = $a->b[0]->c = array('original');
+ foreach($a->b[0]->c as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ class C {
+ public static $a;
+ }
+
+ echo "\n" . 'C::$a' . "\n";
+ C::$a = array('original');
+ $b = C::$a;
+ foreach(C::$a as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . 'C::$a[0]' . "\n";
+ C::$a[0] = array('original');
+ $b = C::$a[0];
+ foreach(C::$a[0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset(C::$a[0], $b);
+
+ echo "\n" . 'C::$a[0]->b' . "\n";
+ C::$a[0]->b = array('original');
+ $b = C::$a[0]->b;
+ foreach(C::$a[0]->b as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset(C::$a[0]->b, $b);
+?>
+--EXPECTF--
+
+$a
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+${'a'}
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$$a
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a[0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a[0][0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b
+
+Warning: Creating default object from empty value in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b->c
+
+Warning: Creating default object from empty value in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b[0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b[0][0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b[0]->c
+
+Warning: Creating default object from empty value in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+C::$a
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+C::$a[0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+C::$a[0]->b
+
+Warning: Creating default object from empty value in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
---TEST--\r
-Ensure foreach works with arrays with Binary keys.\r
---FILE--\r
-<?php\r
-$a = array ( "\x90" => 10 );\r
-foreach ($a as $val=>$key) echo $key;\r
-echo "\nDone\n";\r
-?> \r
---EXPECTF--\r
-10\r
+--TEST--
+Ensure foreach works with arrays with Binary keys.
+--FILE--
+<?php
+$a = array ( "\x90" => 10 );
+foreach ($a as $val=>$key) echo $key;
+echo "\nDone\n";
+?>
+--EXPECTF--
+10
Done
---TEST--\r
-Test + operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($longVals as $longVal) {\r
- foreach($otherVals as $otherVal) {\r
- echo "--- testing: $longVal + $otherVal ---\n"; \r
- var_dump($longVal+$otherVal);\r
- }\r
-}\r
-\r
-foreach ($otherVals as $otherVal) {\r
- foreach($longVals as $longVal) {\r
- echo "--- testing: $otherVal + $longVal ---\n"; \r
- var_dump($otherVal+$longVal);\r
- }\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test + operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
+
+error_reporting(E_ERROR);
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal + $otherVal ---\n";
+ var_dump($longVal+$otherVal);
+ }
+}
+
+foreach ($otherVals as $otherVal) {
+ foreach($longVals as $longVal) {
+ echo "--- testing: $otherVal + $longVal ---\n";
+ var_dump($otherVal+$longVal);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: 9223372036854775807 + 0 ---
int(9223372036854775807)
--- testing: 9223372036854775807 + 1 ---
--- testing: 9223372036854775807 + -9223372036854775807 ---
int(0)
--- testing: 9223372036854775807 + -9.2233720368548E+18 ---
-float(0)\r
-===DONE===\r
+float(0)
+===DONE===
---TEST--\r
-Test + operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' + '$otherVal' ---\n"; \r
- var_dump($strVal+$otherVal);\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test + operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' + '$otherVal' ---\n";
+ var_dump($strVal+$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' + '0' ---
int(0)
--- testing: '0' + '65' ---
--- testing: 'a5.9' + '3.4a' ---
float(3.4)
--- testing: 'a5.9' + 'a5.9' ---
-int(0)\r
-===DONE===\r
+int(0)
+===DONE===
---TEST--\r
-Test & operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' & '$otherVal' ---\n"; \r
- var_dump(bin2hex($strVal&$otherVal));\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test & operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' & '$otherVal' ---\n";
+ var_dump(bin2hex($strVal&$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' & '0' ---
string(2) "30"
--- testing: '0' & '65' ---
--- testing: 'a5.9' & '3.4a' ---
string(8) "21242421"
--- testing: 'a5.9' & 'a5.9' ---
-string(8) "61352e39"\r
-===DONE===\r
+string(8) "61352e39"
+===DONE===
---TEST--\r
-Test ~N operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-\r
-foreach ($strVals as $strVal) {\r
- echo "--- testing: '$strVal' ---\n";\r
- var_dump(bin2hex(~$strVal));\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test ~N operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ var_dump(bin2hex(~$strVal));
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' ---
string(2) "cf"
--- testing: '65' ---
--- testing: '3.4a' ---
string(8) "ccd1cb9e"
--- testing: 'a5.9' ---
-string(8) "9ecad1c6"\r
-===DONE===\r
+string(8) "9ecad1c6"
+===DONE===
---TEST--\r
-Test | operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' | '$otherVal' ---\n"; \r
- var_dump(bin2hex($strVal|$otherVal));\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test | operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' | '$otherVal' ---\n";
+ var_dump(bin2hex($strVal|$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' | '0' ---
string(2) "30"
--- testing: '0' | '65' ---
--- testing: 'a5.9' | '3.4a' ---
string(8) "733f3e79"
--- testing: 'a5.9' | 'a5.9' ---
-string(8) "61352e39"\r
-===DONE===\r
+string(8) "61352e39"
+===DONE===
---TEST--\r
-Test << operator : various numbers as strings\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' << '$otherVal' ---\n";\r
- try { \r
- var_dump($strVal<<$otherVal);\r
- } catch (ArithmeticError $e) {\r
- echo "Exception: " . $e->getMessage() . "\n";\r
- }\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
---- testing: '0' << '0' ---\r
-int(0)\r
---- testing: '0' << '65' ---\r
-int(0)\r
---- testing: '0' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '0' << '1.2' ---\r
-int(0)\r
---- testing: '0' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '0' << 'abc' ---\r
-int(0)\r
---- testing: '0' << '123abc' ---\r
-int(0)\r
---- testing: '0' << '123e5' ---\r
-int(0)\r
---- testing: '0' << '123e5xyz' ---\r
-int(0)\r
---- testing: '0' << ' 123abc' ---\r
-int(0)\r
---- testing: '0' << '123 abc' ---\r
-int(0)\r
---- testing: '0' << '123abc ' ---\r
-int(0)\r
---- testing: '0' << '3.4a' ---\r
-int(0)\r
---- testing: '0' << 'a5.9' ---\r
-int(0)\r
---- testing: '65' << '0' ---\r
-int(65)\r
---- testing: '65' << '65' ---\r
-int(0)\r
---- testing: '65' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '65' << '1.2' ---\r
-int(130)\r
---- testing: '65' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '65' << 'abc' ---\r
-int(65)\r
---- testing: '65' << '123abc' ---\r
-int(0)\r
---- testing: '65' << '123e5' ---\r
-int(0)\r
---- testing: '65' << '123e5xyz' ---\r
-int(0)\r
---- testing: '65' << ' 123abc' ---\r
-int(0)\r
---- testing: '65' << '123 abc' ---\r
-int(0)\r
---- testing: '65' << '123abc ' ---\r
-int(0)\r
---- testing: '65' << '3.4a' ---\r
-int(520)\r
---- testing: '65' << 'a5.9' ---\r
-int(65)\r
---- testing: '-44' << '0' ---\r
-int(-44)\r
---- testing: '-44' << '65' ---\r
-int(0)\r
---- testing: '-44' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '-44' << '1.2' ---\r
-int(-88)\r
---- testing: '-44' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '-44' << 'abc' ---\r
-int(-44)\r
---- testing: '-44' << '123abc' ---\r
-int(0)\r
---- testing: '-44' << '123e5' ---\r
-int(0)\r
---- testing: '-44' << '123e5xyz' ---\r
-int(0)\r
---- testing: '-44' << ' 123abc' ---\r
-int(0)\r
---- testing: '-44' << '123 abc' ---\r
-int(0)\r
---- testing: '-44' << '123abc ' ---\r
-int(0)\r
---- testing: '-44' << '3.4a' ---\r
-int(-352)\r
---- testing: '-44' << 'a5.9' ---\r
-int(-44)\r
---- testing: '1.2' << '0' ---\r
-int(1)\r
---- testing: '1.2' << '65' ---\r
-int(0)\r
---- testing: '1.2' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '1.2' << '1.2' ---\r
-int(2)\r
---- testing: '1.2' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '1.2' << 'abc' ---\r
-int(1)\r
---- testing: '1.2' << '123abc' ---\r
-int(0)\r
---- testing: '1.2' << '123e5' ---\r
-int(0)\r
---- testing: '1.2' << '123e5xyz' ---\r
-int(0)\r
---- testing: '1.2' << ' 123abc' ---\r
-int(0)\r
---- testing: '1.2' << '123 abc' ---\r
-int(0)\r
---- testing: '1.2' << '123abc ' ---\r
-int(0)\r
---- testing: '1.2' << '3.4a' ---\r
-int(8)\r
---- testing: '1.2' << 'a5.9' ---\r
-int(1)\r
---- testing: '-7.7' << '0' ---\r
-int(-7)\r
---- testing: '-7.7' << '65' ---\r
-int(0)\r
---- testing: '-7.7' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '-7.7' << '1.2' ---\r
-int(-14)\r
---- testing: '-7.7' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '-7.7' << 'abc' ---\r
-int(-7)\r
---- testing: '-7.7' << '123abc' ---\r
-int(0)\r
---- testing: '-7.7' << '123e5' ---\r
-int(0)\r
---- testing: '-7.7' << '123e5xyz' ---\r
-int(0)\r
---- testing: '-7.7' << ' 123abc' ---\r
-int(0)\r
---- testing: '-7.7' << '123 abc' ---\r
-int(0)\r
---- testing: '-7.7' << '123abc ' ---\r
-int(0)\r
---- testing: '-7.7' << '3.4a' ---\r
-int(-56)\r
---- testing: '-7.7' << 'a5.9' ---\r
-int(-7)\r
---- testing: 'abc' << '0' ---\r
-int(0)\r
---- testing: 'abc' << '65' ---\r
-int(0)\r
---- testing: 'abc' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: 'abc' << '1.2' ---\r
-int(0)\r
---- testing: 'abc' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: 'abc' << 'abc' ---\r
-int(0)\r
---- testing: 'abc' << '123abc' ---\r
-int(0)\r
---- testing: 'abc' << '123e5' ---\r
-int(0)\r
---- testing: 'abc' << '123e5xyz' ---\r
-int(0)\r
---- testing: 'abc' << ' 123abc' ---\r
-int(0)\r
---- testing: 'abc' << '123 abc' ---\r
-int(0)\r
---- testing: 'abc' << '123abc ' ---\r
-int(0)\r
---- testing: 'abc' << '3.4a' ---\r
-int(0)\r
---- testing: 'abc' << 'a5.9' ---\r
-int(0)\r
---- testing: '123abc' << '0' ---\r
-int(123)\r
---- testing: '123abc' << '65' ---\r
-int(0)\r
---- testing: '123abc' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123abc' << '1.2' ---\r
-int(246)\r
---- testing: '123abc' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123abc' << 'abc' ---\r
-int(123)\r
---- testing: '123abc' << '123abc' ---\r
-int(0)\r
---- testing: '123abc' << '123e5' ---\r
-int(0)\r
---- testing: '123abc' << '123e5xyz' ---\r
-int(0)\r
---- testing: '123abc' << ' 123abc' ---\r
-int(0)\r
---- testing: '123abc' << '123 abc' ---\r
-int(0)\r
---- testing: '123abc' << '123abc ' ---\r
-int(0)\r
---- testing: '123abc' << '3.4a' ---\r
-int(984)\r
---- testing: '123abc' << 'a5.9' ---\r
-int(123)\r
---- testing: '123e5' << '0' ---\r
-int(12300000)\r
---- testing: '123e5' << '65' ---\r
-int(0)\r
---- testing: '123e5' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123e5' << '1.2' ---\r
-int(24600000)\r
---- testing: '123e5' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123e5' << 'abc' ---\r
-int(12300000)\r
---- testing: '123e5' << '123abc' ---\r
-int(0)\r
---- testing: '123e5' << '123e5' ---\r
-int(0)\r
---- testing: '123e5' << '123e5xyz' ---\r
-int(0)\r
---- testing: '123e5' << ' 123abc' ---\r
-int(0)\r
---- testing: '123e5' << '123 abc' ---\r
-int(0)\r
---- testing: '123e5' << '123abc ' ---\r
-int(0)\r
---- testing: '123e5' << '3.4a' ---\r
-int(98400000)\r
---- testing: '123e5' << 'a5.9' ---\r
-int(12300000)\r
---- testing: '123e5xyz' << '0' ---\r
-int(12300000)\r
---- testing: '123e5xyz' << '65' ---\r
-int(0)\r
---- testing: '123e5xyz' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123e5xyz' << '1.2' ---\r
-int(24600000)\r
---- testing: '123e5xyz' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123e5xyz' << 'abc' ---\r
-int(12300000)\r
---- testing: '123e5xyz' << '123abc' ---\r
-int(0)\r
---- testing: '123e5xyz' << '123e5' ---\r
-int(0)\r
---- testing: '123e5xyz' << '123e5xyz' ---\r
-int(0)\r
---- testing: '123e5xyz' << ' 123abc' ---\r
-int(0)\r
---- testing: '123e5xyz' << '123 abc' ---\r
-int(0)\r
---- testing: '123e5xyz' << '123abc ' ---\r
-int(0)\r
---- testing: '123e5xyz' << '3.4a' ---\r
-int(98400000)\r
---- testing: '123e5xyz' << 'a5.9' ---\r
-int(12300000)\r
---- testing: ' 123abc' << '0' ---\r
-int(123)\r
---- testing: ' 123abc' << '65' ---\r
-int(0)\r
---- testing: ' 123abc' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: ' 123abc' << '1.2' ---\r
-int(246)\r
---- testing: ' 123abc' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: ' 123abc' << 'abc' ---\r
-int(123)\r
---- testing: ' 123abc' << '123abc' ---\r
-int(0)\r
---- testing: ' 123abc' << '123e5' ---\r
-int(0)\r
---- testing: ' 123abc' << '123e5xyz' ---\r
-int(0)\r
---- testing: ' 123abc' << ' 123abc' ---\r
-int(0)\r
---- testing: ' 123abc' << '123 abc' ---\r
-int(0)\r
---- testing: ' 123abc' << '123abc ' ---\r
-int(0)\r
---- testing: ' 123abc' << '3.4a' ---\r
-int(984)\r
---- testing: ' 123abc' << 'a5.9' ---\r
-int(123)\r
---- testing: '123 abc' << '0' ---\r
-int(123)\r
---- testing: '123 abc' << '65' ---\r
-int(0)\r
---- testing: '123 abc' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123 abc' << '1.2' ---\r
-int(246)\r
---- testing: '123 abc' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123 abc' << 'abc' ---\r
-int(123)\r
---- testing: '123 abc' << '123abc' ---\r
-int(0)\r
---- testing: '123 abc' << '123e5' ---\r
-int(0)\r
---- testing: '123 abc' << '123e5xyz' ---\r
-int(0)\r
---- testing: '123 abc' << ' 123abc' ---\r
-int(0)\r
---- testing: '123 abc' << '123 abc' ---\r
-int(0)\r
---- testing: '123 abc' << '123abc ' ---\r
-int(0)\r
---- testing: '123 abc' << '3.4a' ---\r
-int(984)\r
---- testing: '123 abc' << 'a5.9' ---\r
-int(123)\r
---- testing: '123abc ' << '0' ---\r
-int(123)\r
---- testing: '123abc ' << '65' ---\r
-int(0)\r
---- testing: '123abc ' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123abc ' << '1.2' ---\r
-int(246)\r
---- testing: '123abc ' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '123abc ' << 'abc' ---\r
-int(123)\r
---- testing: '123abc ' << '123abc' ---\r
-int(0)\r
---- testing: '123abc ' << '123e5' ---\r
-int(0)\r
---- testing: '123abc ' << '123e5xyz' ---\r
-int(0)\r
---- testing: '123abc ' << ' 123abc' ---\r
-int(0)\r
---- testing: '123abc ' << '123 abc' ---\r
-int(0)\r
---- testing: '123abc ' << '123abc ' ---\r
-int(0)\r
---- testing: '123abc ' << '3.4a' ---\r
-int(984)\r
---- testing: '123abc ' << 'a5.9' ---\r
-int(123)\r
---- testing: '3.4a' << '0' ---\r
-int(3)\r
---- testing: '3.4a' << '65' ---\r
-int(0)\r
---- testing: '3.4a' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: '3.4a' << '1.2' ---\r
-int(6)\r
---- testing: '3.4a' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: '3.4a' << 'abc' ---\r
-int(3)\r
---- testing: '3.4a' << '123abc' ---\r
-int(0)\r
---- testing: '3.4a' << '123e5' ---\r
-int(0)\r
---- testing: '3.4a' << '123e5xyz' ---\r
-int(0)\r
---- testing: '3.4a' << ' 123abc' ---\r
-int(0)\r
---- testing: '3.4a' << '123 abc' ---\r
-int(0)\r
---- testing: '3.4a' << '123abc ' ---\r
-int(0)\r
---- testing: '3.4a' << '3.4a' ---\r
-int(24)\r
---- testing: '3.4a' << 'a5.9' ---\r
-int(3)\r
---- testing: 'a5.9' << '0' ---\r
-int(0)\r
---- testing: 'a5.9' << '65' ---\r
-int(0)\r
---- testing: 'a5.9' << '-44' ---\r
-Exception: Bit shift by negative number\r
---- testing: 'a5.9' << '1.2' ---\r
-int(0)\r
---- testing: 'a5.9' << '-7.7' ---\r
-Exception: Bit shift by negative number\r
---- testing: 'a5.9' << 'abc' ---\r
-int(0)\r
---- testing: 'a5.9' << '123abc' ---\r
-int(0)\r
---- testing: 'a5.9' << '123e5' ---\r
-int(0)\r
---- testing: 'a5.9' << '123e5xyz' ---\r
-int(0)\r
---- testing: 'a5.9' << ' 123abc' ---\r
-int(0)\r
---- testing: 'a5.9' << '123 abc' ---\r
-int(0)\r
---- testing: 'a5.9' << '123abc ' ---\r
-int(0)\r
---- testing: 'a5.9' << '3.4a' ---\r
-int(0)\r
---- testing: 'a5.9' << 'a5.9' ---\r
-int(0)\r
-===DONE===\r
+--TEST--
+Test << operator : various numbers as strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' << '$otherVal' ---\n";
+ try {
+ var_dump($strVal<<$otherVal);
+ } catch (ArithmeticError $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' << '0' ---
+int(0)
+--- testing: '0' << '65' ---
+int(0)
+--- testing: '0' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '0' << '1.2' ---
+int(0)
+--- testing: '0' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '0' << 'abc' ---
+int(0)
+--- testing: '0' << '123abc' ---
+int(0)
+--- testing: '0' << '123e5' ---
+int(0)
+--- testing: '0' << '123e5xyz' ---
+int(0)
+--- testing: '0' << ' 123abc' ---
+int(0)
+--- testing: '0' << '123 abc' ---
+int(0)
+--- testing: '0' << '123abc ' ---
+int(0)
+--- testing: '0' << '3.4a' ---
+int(0)
+--- testing: '0' << 'a5.9' ---
+int(0)
+--- testing: '65' << '0' ---
+int(65)
+--- testing: '65' << '65' ---
+int(0)
+--- testing: '65' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '65' << '1.2' ---
+int(130)
+--- testing: '65' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '65' << 'abc' ---
+int(65)
+--- testing: '65' << '123abc' ---
+int(0)
+--- testing: '65' << '123e5' ---
+int(0)
+--- testing: '65' << '123e5xyz' ---
+int(0)
+--- testing: '65' << ' 123abc' ---
+int(0)
+--- testing: '65' << '123 abc' ---
+int(0)
+--- testing: '65' << '123abc ' ---
+int(0)
+--- testing: '65' << '3.4a' ---
+int(520)
+--- testing: '65' << 'a5.9' ---
+int(65)
+--- testing: '-44' << '0' ---
+int(-44)
+--- testing: '-44' << '65' ---
+int(0)
+--- testing: '-44' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '-44' << '1.2' ---
+int(-88)
+--- testing: '-44' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '-44' << 'abc' ---
+int(-44)
+--- testing: '-44' << '123abc' ---
+int(0)
+--- testing: '-44' << '123e5' ---
+int(0)
+--- testing: '-44' << '123e5xyz' ---
+int(0)
+--- testing: '-44' << ' 123abc' ---
+int(0)
+--- testing: '-44' << '123 abc' ---
+int(0)
+--- testing: '-44' << '123abc ' ---
+int(0)
+--- testing: '-44' << '3.4a' ---
+int(-352)
+--- testing: '-44' << 'a5.9' ---
+int(-44)
+--- testing: '1.2' << '0' ---
+int(1)
+--- testing: '1.2' << '65' ---
+int(0)
+--- testing: '1.2' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '1.2' << '1.2' ---
+int(2)
+--- testing: '1.2' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '1.2' << 'abc' ---
+int(1)
+--- testing: '1.2' << '123abc' ---
+int(0)
+--- testing: '1.2' << '123e5' ---
+int(0)
+--- testing: '1.2' << '123e5xyz' ---
+int(0)
+--- testing: '1.2' << ' 123abc' ---
+int(0)
+--- testing: '1.2' << '123 abc' ---
+int(0)
+--- testing: '1.2' << '123abc ' ---
+int(0)
+--- testing: '1.2' << '3.4a' ---
+int(8)
+--- testing: '1.2' << 'a5.9' ---
+int(1)
+--- testing: '-7.7' << '0' ---
+int(-7)
+--- testing: '-7.7' << '65' ---
+int(0)
+--- testing: '-7.7' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '-7.7' << '1.2' ---
+int(-14)
+--- testing: '-7.7' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '-7.7' << 'abc' ---
+int(-7)
+--- testing: '-7.7' << '123abc' ---
+int(0)
+--- testing: '-7.7' << '123e5' ---
+int(0)
+--- testing: '-7.7' << '123e5xyz' ---
+int(0)
+--- testing: '-7.7' << ' 123abc' ---
+int(0)
+--- testing: '-7.7' << '123 abc' ---
+int(0)
+--- testing: '-7.7' << '123abc ' ---
+int(0)
+--- testing: '-7.7' << '3.4a' ---
+int(-56)
+--- testing: '-7.7' << 'a5.9' ---
+int(-7)
+--- testing: 'abc' << '0' ---
+int(0)
+--- testing: 'abc' << '65' ---
+int(0)
+--- testing: 'abc' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: 'abc' << '1.2' ---
+int(0)
+--- testing: 'abc' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: 'abc' << 'abc' ---
+int(0)
+--- testing: 'abc' << '123abc' ---
+int(0)
+--- testing: 'abc' << '123e5' ---
+int(0)
+--- testing: 'abc' << '123e5xyz' ---
+int(0)
+--- testing: 'abc' << ' 123abc' ---
+int(0)
+--- testing: 'abc' << '123 abc' ---
+int(0)
+--- testing: 'abc' << '123abc ' ---
+int(0)
+--- testing: 'abc' << '3.4a' ---
+int(0)
+--- testing: 'abc' << 'a5.9' ---
+int(0)
+--- testing: '123abc' << '0' ---
+int(123)
+--- testing: '123abc' << '65' ---
+int(0)
+--- testing: '123abc' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '123abc' << '1.2' ---
+int(246)
+--- testing: '123abc' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '123abc' << 'abc' ---
+int(123)
+--- testing: '123abc' << '123abc' ---
+int(0)
+--- testing: '123abc' << '123e5' ---
+int(0)
+--- testing: '123abc' << '123e5xyz' ---
+int(0)
+--- testing: '123abc' << ' 123abc' ---
+int(0)
+--- testing: '123abc' << '123 abc' ---
+int(0)
+--- testing: '123abc' << '123abc ' ---
+int(0)
+--- testing: '123abc' << '3.4a' ---
+int(984)
+--- testing: '123abc' << 'a5.9' ---
+int(123)
+--- testing: '123e5' << '0' ---
+int(12300000)
+--- testing: '123e5' << '65' ---
+int(0)
+--- testing: '123e5' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '123e5' << '1.2' ---
+int(24600000)
+--- testing: '123e5' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '123e5' << 'abc' ---
+int(12300000)
+--- testing: '123e5' << '123abc' ---
+int(0)
+--- testing: '123e5' << '123e5' ---
+int(0)
+--- testing: '123e5' << '123e5xyz' ---
+int(0)
+--- testing: '123e5' << ' 123abc' ---
+int(0)
+--- testing: '123e5' << '123 abc' ---
+int(0)
+--- testing: '123e5' << '123abc ' ---
+int(0)
+--- testing: '123e5' << '3.4a' ---
+int(98400000)
+--- testing: '123e5' << 'a5.9' ---
+int(12300000)
+--- testing: '123e5xyz' << '0' ---
+int(12300000)
+--- testing: '123e5xyz' << '65' ---
+int(0)
+--- testing: '123e5xyz' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '123e5xyz' << '1.2' ---
+int(24600000)
+--- testing: '123e5xyz' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '123e5xyz' << 'abc' ---
+int(12300000)
+--- testing: '123e5xyz' << '123abc' ---
+int(0)
+--- testing: '123e5xyz' << '123e5' ---
+int(0)
+--- testing: '123e5xyz' << '123e5xyz' ---
+int(0)
+--- testing: '123e5xyz' << ' 123abc' ---
+int(0)
+--- testing: '123e5xyz' << '123 abc' ---
+int(0)
+--- testing: '123e5xyz' << '123abc ' ---
+int(0)
+--- testing: '123e5xyz' << '3.4a' ---
+int(98400000)
+--- testing: '123e5xyz' << 'a5.9' ---
+int(12300000)
+--- testing: ' 123abc' << '0' ---
+int(123)
+--- testing: ' 123abc' << '65' ---
+int(0)
+--- testing: ' 123abc' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: ' 123abc' << '1.2' ---
+int(246)
+--- testing: ' 123abc' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: ' 123abc' << 'abc' ---
+int(123)
+--- testing: ' 123abc' << '123abc' ---
+int(0)
+--- testing: ' 123abc' << '123e5' ---
+int(0)
+--- testing: ' 123abc' << '123e5xyz' ---
+int(0)
+--- testing: ' 123abc' << ' 123abc' ---
+int(0)
+--- testing: ' 123abc' << '123 abc' ---
+int(0)
+--- testing: ' 123abc' << '123abc ' ---
+int(0)
+--- testing: ' 123abc' << '3.4a' ---
+int(984)
+--- testing: ' 123abc' << 'a5.9' ---
+int(123)
+--- testing: '123 abc' << '0' ---
+int(123)
+--- testing: '123 abc' << '65' ---
+int(0)
+--- testing: '123 abc' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '123 abc' << '1.2' ---
+int(246)
+--- testing: '123 abc' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '123 abc' << 'abc' ---
+int(123)
+--- testing: '123 abc' << '123abc' ---
+int(0)
+--- testing: '123 abc' << '123e5' ---
+int(0)
+--- testing: '123 abc' << '123e5xyz' ---
+int(0)
+--- testing: '123 abc' << ' 123abc' ---
+int(0)
+--- testing: '123 abc' << '123 abc' ---
+int(0)
+--- testing: '123 abc' << '123abc ' ---
+int(0)
+--- testing: '123 abc' << '3.4a' ---
+int(984)
+--- testing: '123 abc' << 'a5.9' ---
+int(123)
+--- testing: '123abc ' << '0' ---
+int(123)
+--- testing: '123abc ' << '65' ---
+int(0)
+--- testing: '123abc ' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '123abc ' << '1.2' ---
+int(246)
+--- testing: '123abc ' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '123abc ' << 'abc' ---
+int(123)
+--- testing: '123abc ' << '123abc' ---
+int(0)
+--- testing: '123abc ' << '123e5' ---
+int(0)
+--- testing: '123abc ' << '123e5xyz' ---
+int(0)
+--- testing: '123abc ' << ' 123abc' ---
+int(0)
+--- testing: '123abc ' << '123 abc' ---
+int(0)
+--- testing: '123abc ' << '123abc ' ---
+int(0)
+--- testing: '123abc ' << '3.4a' ---
+int(984)
+--- testing: '123abc ' << 'a5.9' ---
+int(123)
+--- testing: '3.4a' << '0' ---
+int(3)
+--- testing: '3.4a' << '65' ---
+int(0)
+--- testing: '3.4a' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: '3.4a' << '1.2' ---
+int(6)
+--- testing: '3.4a' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: '3.4a' << 'abc' ---
+int(3)
+--- testing: '3.4a' << '123abc' ---
+int(0)
+--- testing: '3.4a' << '123e5' ---
+int(0)
+--- testing: '3.4a' << '123e5xyz' ---
+int(0)
+--- testing: '3.4a' << ' 123abc' ---
+int(0)
+--- testing: '3.4a' << '123 abc' ---
+int(0)
+--- testing: '3.4a' << '123abc ' ---
+int(0)
+--- testing: '3.4a' << '3.4a' ---
+int(24)
+--- testing: '3.4a' << 'a5.9' ---
+int(3)
+--- testing: 'a5.9' << '0' ---
+int(0)
+--- testing: 'a5.9' << '65' ---
+int(0)
+--- testing: 'a5.9' << '-44' ---
+Exception: Bit shift by negative number
+--- testing: 'a5.9' << '1.2' ---
+int(0)
+--- testing: 'a5.9' << '-7.7' ---
+Exception: Bit shift by negative number
+--- testing: 'a5.9' << 'abc' ---
+int(0)
+--- testing: 'a5.9' << '123abc' ---
+int(0)
+--- testing: 'a5.9' << '123e5' ---
+int(0)
+--- testing: 'a5.9' << '123e5xyz' ---
+int(0)
+--- testing: 'a5.9' << ' 123abc' ---
+int(0)
+--- testing: 'a5.9' << '123 abc' ---
+int(0)
+--- testing: 'a5.9' << '123abc ' ---
+int(0)
+--- testing: 'a5.9' << '3.4a' ---
+int(0)
+--- testing: 'a5.9' << 'a5.9' ---
+int(0)
+===DONE===
---TEST--\r
-Test ^ operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' ^ '$otherVal' ---\n"; \r
- var_dump(bin2hex($strVal^$otherVal));\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test ^ operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' ^ '$otherVal' ---\n";
+ var_dump(bin2hex($strVal^$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' ^ '0' ---
string(2) "00"
--- testing: '0' ^ '65' ---
--- testing: 'a5.9' ^ '3.4a' ---
string(8) "521b1a58"
--- testing: 'a5.9' ^ 'a5.9' ---
-string(8) "00000000"\r
-===DONE===\r
+string(8) "00000000"
+===DONE===
---TEST--\r
-Test / operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($longVals as $longVal) {\r
- foreach($otherVals as $otherVal) {\r
- echo "--- testing: $longVal / $otherVal ---\n"; \r
- var_dump($longVal/$otherVal);\r
- }\r
-}\r
-\r
-foreach ($otherVals as $otherVal) {\r
- foreach($longVals as $longVal) {\r
- echo "--- testing: $otherVal / $longVal ---\n"; \r
- var_dump($otherVal/$longVal);\r
- }\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test / operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
+
+error_reporting(E_ERROR);
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal / $otherVal ---\n";
+ var_dump($longVal/$otherVal);
+ }
+}
+
+foreach ($otherVals as $otherVal) {
+ foreach($longVals as $longVal) {
+ echo "--- testing: $otherVal / $longVal ---\n";
+ var_dump($otherVal/$longVal);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: 9223372036854775807 / 0 ---
float(INF)
--- testing: 9223372036854775807 / 1 ---
--- testing: 9223372036854775807 / -9223372036854775807 ---
int(-1)
--- testing: 9223372036854775807 / -9.2233720368548E+18 ---
-float(-1)\r
-===DONE===\r
+float(-1)
+===DONE===
---TEST--\r
-Test / operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' / '$otherVal' ---\n"; \r
- var_dump($strVal/$otherVal);\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test / operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' / '$otherVal' ---\n";
+ var_dump($strVal/$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' / '0' ---
float(NAN)
--- testing: '0' / '65' ---
--- testing: 'a5.9' / '3.4a' ---
float(0)
--- testing: 'a5.9' / 'a5.9' ---
-float(NAN)\r
-===DONE===\r
+float(NAN)
+===DONE===
---TEST--\r
-Test % operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' % '$otherVal' ---\n";\r
- try {\r
- var_dump($strVal%$otherVal);\r
- } catch (DivisionByZeroError $e) {\r
- echo "Exception: " . $e->getMessage() . "\n";\r
- }\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
---- testing: '0' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '0' % '65' ---\r
-int(0)\r
---- testing: '0' % '-44' ---\r
-int(0)\r
---- testing: '0' % '1.2' ---\r
-int(0)\r
---- testing: '0' % '-7.7' ---\r
-int(0)\r
---- testing: '0' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '0' % '123abc' ---\r
-int(0)\r
---- testing: '0' % '123e5' ---\r
-int(0)\r
---- testing: '0' % '123e5xyz' ---\r
-int(0)\r
---- testing: '0' % ' 123abc' ---\r
-int(0)\r
---- testing: '0' % '123 abc' ---\r
-int(0)\r
---- testing: '0' % '123abc ' ---\r
-int(0)\r
---- testing: '0' % '3.4a' ---\r
-int(0)\r
---- testing: '0' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '65' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '65' % '65' ---\r
-int(0)\r
---- testing: '65' % '-44' ---\r
-int(21)\r
---- testing: '65' % '1.2' ---\r
-int(0)\r
---- testing: '65' % '-7.7' ---\r
-int(2)\r
---- testing: '65' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '65' % '123abc' ---\r
-int(65)\r
---- testing: '65' % '123e5' ---\r
-int(65)\r
---- testing: '65' % '123e5xyz' ---\r
-int(65)\r
---- testing: '65' % ' 123abc' ---\r
-int(65)\r
---- testing: '65' % '123 abc' ---\r
-int(65)\r
---- testing: '65' % '123abc ' ---\r
-int(65)\r
---- testing: '65' % '3.4a' ---\r
-int(2)\r
---- testing: '65' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '-44' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '-44' % '65' ---\r
-int(-44)\r
---- testing: '-44' % '-44' ---\r
-int(0)\r
---- testing: '-44' % '1.2' ---\r
-int(0)\r
---- testing: '-44' % '-7.7' ---\r
-int(-2)\r
---- testing: '-44' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '-44' % '123abc' ---\r
-int(-44)\r
---- testing: '-44' % '123e5' ---\r
-int(-44)\r
---- testing: '-44' % '123e5xyz' ---\r
-int(-44)\r
---- testing: '-44' % ' 123abc' ---\r
-int(-44)\r
---- testing: '-44' % '123 abc' ---\r
-int(-44)\r
---- testing: '-44' % '123abc ' ---\r
-int(-44)\r
---- testing: '-44' % '3.4a' ---\r
-int(-2)\r
---- testing: '-44' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '1.2' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '1.2' % '65' ---\r
-int(1)\r
---- testing: '1.2' % '-44' ---\r
-int(1)\r
---- testing: '1.2' % '1.2' ---\r
-int(0)\r
---- testing: '1.2' % '-7.7' ---\r
-int(1)\r
---- testing: '1.2' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '1.2' % '123abc' ---\r
-int(1)\r
---- testing: '1.2' % '123e5' ---\r
-int(1)\r
---- testing: '1.2' % '123e5xyz' ---\r
-int(1)\r
---- testing: '1.2' % ' 123abc' ---\r
-int(1)\r
---- testing: '1.2' % '123 abc' ---\r
-int(1)\r
---- testing: '1.2' % '123abc ' ---\r
-int(1)\r
---- testing: '1.2' % '3.4a' ---\r
-int(1)\r
---- testing: '1.2' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '-7.7' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '-7.7' % '65' ---\r
-int(-7)\r
---- testing: '-7.7' % '-44' ---\r
-int(-7)\r
---- testing: '-7.7' % '1.2' ---\r
-int(0)\r
---- testing: '-7.7' % '-7.7' ---\r
-int(0)\r
---- testing: '-7.7' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '-7.7' % '123abc' ---\r
-int(-7)\r
---- testing: '-7.7' % '123e5' ---\r
-int(-7)\r
---- testing: '-7.7' % '123e5xyz' ---\r
-int(-7)\r
---- testing: '-7.7' % ' 123abc' ---\r
-int(-7)\r
---- testing: '-7.7' % '123 abc' ---\r
-int(-7)\r
---- testing: '-7.7' % '123abc ' ---\r
-int(-7)\r
---- testing: '-7.7' % '3.4a' ---\r
-int(-1)\r
---- testing: '-7.7' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: 'abc' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: 'abc' % '65' ---\r
-int(0)\r
---- testing: 'abc' % '-44' ---\r
-int(0)\r
---- testing: 'abc' % '1.2' ---\r
-int(0)\r
---- testing: 'abc' % '-7.7' ---\r
-int(0)\r
---- testing: 'abc' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: 'abc' % '123abc' ---\r
-int(0)\r
---- testing: 'abc' % '123e5' ---\r
-int(0)\r
---- testing: 'abc' % '123e5xyz' ---\r
-int(0)\r
---- testing: 'abc' % ' 123abc' ---\r
-int(0)\r
---- testing: 'abc' % '123 abc' ---\r
-int(0)\r
---- testing: 'abc' % '123abc ' ---\r
-int(0)\r
---- testing: 'abc' % '3.4a' ---\r
-int(0)\r
---- testing: 'abc' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '123abc' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '123abc' % '65' ---\r
-int(58)\r
---- testing: '123abc' % '-44' ---\r
-int(35)\r
---- testing: '123abc' % '1.2' ---\r
-int(0)\r
---- testing: '123abc' % '-7.7' ---\r
-int(4)\r
---- testing: '123abc' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '123abc' % '123abc' ---\r
-int(0)\r
---- testing: '123abc' % '123e5' ---\r
-int(123)\r
---- testing: '123abc' % '123e5xyz' ---\r
-int(123)\r
---- testing: '123abc' % ' 123abc' ---\r
-int(0)\r
---- testing: '123abc' % '123 abc' ---\r
-int(0)\r
---- testing: '123abc' % '123abc ' ---\r
-int(0)\r
---- testing: '123abc' % '3.4a' ---\r
-int(0)\r
---- testing: '123abc' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '123e5' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '123e5' % '65' ---\r
-int(50)\r
---- testing: '123e5' % '-44' ---\r
-int(20)\r
---- testing: '123e5' % '1.2' ---\r
-int(0)\r
---- testing: '123e5' % '-7.7' ---\r
-int(6)\r
---- testing: '123e5' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '123e5' % '123abc' ---\r
-int(0)\r
---- testing: '123e5' % '123e5' ---\r
-int(0)\r
---- testing: '123e5' % '123e5xyz' ---\r
-int(0)\r
---- testing: '123e5' % ' 123abc' ---\r
-int(0)\r
---- testing: '123e5' % '123 abc' ---\r
-int(0)\r
---- testing: '123e5' % '123abc ' ---\r
-int(0)\r
---- testing: '123e5' % '3.4a' ---\r
-int(0)\r
---- testing: '123e5' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '123e5xyz' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '123e5xyz' % '65' ---\r
-int(50)\r
---- testing: '123e5xyz' % '-44' ---\r
-int(20)\r
---- testing: '123e5xyz' % '1.2' ---\r
-int(0)\r
---- testing: '123e5xyz' % '-7.7' ---\r
-int(6)\r
---- testing: '123e5xyz' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '123e5xyz' % '123abc' ---\r
-int(0)\r
---- testing: '123e5xyz' % '123e5' ---\r
-int(0)\r
---- testing: '123e5xyz' % '123e5xyz' ---\r
-int(0)\r
---- testing: '123e5xyz' % ' 123abc' ---\r
-int(0)\r
---- testing: '123e5xyz' % '123 abc' ---\r
-int(0)\r
---- testing: '123e5xyz' % '123abc ' ---\r
-int(0)\r
---- testing: '123e5xyz' % '3.4a' ---\r
-int(0)\r
---- testing: '123e5xyz' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: ' 123abc' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: ' 123abc' % '65' ---\r
-int(58)\r
---- testing: ' 123abc' % '-44' ---\r
-int(35)\r
---- testing: ' 123abc' % '1.2' ---\r
-int(0)\r
---- testing: ' 123abc' % '-7.7' ---\r
-int(4)\r
---- testing: ' 123abc' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: ' 123abc' % '123abc' ---\r
-int(0)\r
---- testing: ' 123abc' % '123e5' ---\r
-int(123)\r
---- testing: ' 123abc' % '123e5xyz' ---\r
-int(123)\r
---- testing: ' 123abc' % ' 123abc' ---\r
-int(0)\r
---- testing: ' 123abc' % '123 abc' ---\r
-int(0)\r
---- testing: ' 123abc' % '123abc ' ---\r
-int(0)\r
---- testing: ' 123abc' % '3.4a' ---\r
-int(0)\r
---- testing: ' 123abc' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '123 abc' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '123 abc' % '65' ---\r
-int(58)\r
---- testing: '123 abc' % '-44' ---\r
-int(35)\r
---- testing: '123 abc' % '1.2' ---\r
-int(0)\r
---- testing: '123 abc' % '-7.7' ---\r
-int(4)\r
---- testing: '123 abc' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '123 abc' % '123abc' ---\r
-int(0)\r
---- testing: '123 abc' % '123e5' ---\r
-int(123)\r
---- testing: '123 abc' % '123e5xyz' ---\r
-int(123)\r
---- testing: '123 abc' % ' 123abc' ---\r
-int(0)\r
---- testing: '123 abc' % '123 abc' ---\r
-int(0)\r
---- testing: '123 abc' % '123abc ' ---\r
-int(0)\r
---- testing: '123 abc' % '3.4a' ---\r
-int(0)\r
---- testing: '123 abc' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '123abc ' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '123abc ' % '65' ---\r
-int(58)\r
---- testing: '123abc ' % '-44' ---\r
-int(35)\r
---- testing: '123abc ' % '1.2' ---\r
-int(0)\r
---- testing: '123abc ' % '-7.7' ---\r
-int(4)\r
---- testing: '123abc ' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '123abc ' % '123abc' ---\r
-int(0)\r
---- testing: '123abc ' % '123e5' ---\r
-int(123)\r
---- testing: '123abc ' % '123e5xyz' ---\r
-int(123)\r
---- testing: '123abc ' % ' 123abc' ---\r
-int(0)\r
---- testing: '123abc ' % '123 abc' ---\r
-int(0)\r
---- testing: '123abc ' % '123abc ' ---\r
-int(0)\r
---- testing: '123abc ' % '3.4a' ---\r
-int(0)\r
---- testing: '123abc ' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: '3.4a' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: '3.4a' % '65' ---\r
-int(3)\r
---- testing: '3.4a' % '-44' ---\r
-int(3)\r
---- testing: '3.4a' % '1.2' ---\r
-int(0)\r
---- testing: '3.4a' % '-7.7' ---\r
-int(3)\r
---- testing: '3.4a' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: '3.4a' % '123abc' ---\r
-int(3)\r
---- testing: '3.4a' % '123e5' ---\r
-int(3)\r
---- testing: '3.4a' % '123e5xyz' ---\r
-int(3)\r
---- testing: '3.4a' % ' 123abc' ---\r
-int(3)\r
---- testing: '3.4a' % '123 abc' ---\r
-int(3)\r
---- testing: '3.4a' % '123abc ' ---\r
-int(3)\r
---- testing: '3.4a' % '3.4a' ---\r
-int(0)\r
---- testing: '3.4a' % 'a5.9' ---\r
-Exception: Modulo by zero\r
---- testing: 'a5.9' % '0' ---\r
-Exception: Modulo by zero\r
---- testing: 'a5.9' % '65' ---\r
-int(0)\r
---- testing: 'a5.9' % '-44' ---\r
-int(0)\r
---- testing: 'a5.9' % '1.2' ---\r
-int(0)\r
---- testing: 'a5.9' % '-7.7' ---\r
-int(0)\r
---- testing: 'a5.9' % 'abc' ---\r
-Exception: Modulo by zero\r
---- testing: 'a5.9' % '123abc' ---\r
-int(0)\r
---- testing: 'a5.9' % '123e5' ---\r
-int(0)\r
---- testing: 'a5.9' % '123e5xyz' ---\r
-int(0)\r
---- testing: 'a5.9' % ' 123abc' ---\r
-int(0)\r
---- testing: 'a5.9' % '123 abc' ---\r
-int(0)\r
---- testing: 'a5.9' % '123abc ' ---\r
-int(0)\r
---- testing: 'a5.9' % '3.4a' ---\r
-int(0)\r
---- testing: 'a5.9' % 'a5.9' ---\r
-Exception: Modulo by zero\r
-===DONE===\r
+--TEST--
+Test % operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' % '$otherVal' ---\n";
+ try {
+ var_dump($strVal%$otherVal);
+ } catch (DivisionByZeroError $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' % '0' ---
+Exception: Modulo by zero
+--- testing: '0' % '65' ---
+int(0)
+--- testing: '0' % '-44' ---
+int(0)
+--- testing: '0' % '1.2' ---
+int(0)
+--- testing: '0' % '-7.7' ---
+int(0)
+--- testing: '0' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '0' % '123abc' ---
+int(0)
+--- testing: '0' % '123e5' ---
+int(0)
+--- testing: '0' % '123e5xyz' ---
+int(0)
+--- testing: '0' % ' 123abc' ---
+int(0)
+--- testing: '0' % '123 abc' ---
+int(0)
+--- testing: '0' % '123abc ' ---
+int(0)
+--- testing: '0' % '3.4a' ---
+int(0)
+--- testing: '0' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '65' % '0' ---
+Exception: Modulo by zero
+--- testing: '65' % '65' ---
+int(0)
+--- testing: '65' % '-44' ---
+int(21)
+--- testing: '65' % '1.2' ---
+int(0)
+--- testing: '65' % '-7.7' ---
+int(2)
+--- testing: '65' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '65' % '123abc' ---
+int(65)
+--- testing: '65' % '123e5' ---
+int(65)
+--- testing: '65' % '123e5xyz' ---
+int(65)
+--- testing: '65' % ' 123abc' ---
+int(65)
+--- testing: '65' % '123 abc' ---
+int(65)
+--- testing: '65' % '123abc ' ---
+int(65)
+--- testing: '65' % '3.4a' ---
+int(2)
+--- testing: '65' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '-44' % '0' ---
+Exception: Modulo by zero
+--- testing: '-44' % '65' ---
+int(-44)
+--- testing: '-44' % '-44' ---
+int(0)
+--- testing: '-44' % '1.2' ---
+int(0)
+--- testing: '-44' % '-7.7' ---
+int(-2)
+--- testing: '-44' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '-44' % '123abc' ---
+int(-44)
+--- testing: '-44' % '123e5' ---
+int(-44)
+--- testing: '-44' % '123e5xyz' ---
+int(-44)
+--- testing: '-44' % ' 123abc' ---
+int(-44)
+--- testing: '-44' % '123 abc' ---
+int(-44)
+--- testing: '-44' % '123abc ' ---
+int(-44)
+--- testing: '-44' % '3.4a' ---
+int(-2)
+--- testing: '-44' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '1.2' % '0' ---
+Exception: Modulo by zero
+--- testing: '1.2' % '65' ---
+int(1)
+--- testing: '1.2' % '-44' ---
+int(1)
+--- testing: '1.2' % '1.2' ---
+int(0)
+--- testing: '1.2' % '-7.7' ---
+int(1)
+--- testing: '1.2' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '1.2' % '123abc' ---
+int(1)
+--- testing: '1.2' % '123e5' ---
+int(1)
+--- testing: '1.2' % '123e5xyz' ---
+int(1)
+--- testing: '1.2' % ' 123abc' ---
+int(1)
+--- testing: '1.2' % '123 abc' ---
+int(1)
+--- testing: '1.2' % '123abc ' ---
+int(1)
+--- testing: '1.2' % '3.4a' ---
+int(1)
+--- testing: '1.2' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '-7.7' % '0' ---
+Exception: Modulo by zero
+--- testing: '-7.7' % '65' ---
+int(-7)
+--- testing: '-7.7' % '-44' ---
+int(-7)
+--- testing: '-7.7' % '1.2' ---
+int(0)
+--- testing: '-7.7' % '-7.7' ---
+int(0)
+--- testing: '-7.7' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '-7.7' % '123abc' ---
+int(-7)
+--- testing: '-7.7' % '123e5' ---
+int(-7)
+--- testing: '-7.7' % '123e5xyz' ---
+int(-7)
+--- testing: '-7.7' % ' 123abc' ---
+int(-7)
+--- testing: '-7.7' % '123 abc' ---
+int(-7)
+--- testing: '-7.7' % '123abc ' ---
+int(-7)
+--- testing: '-7.7' % '3.4a' ---
+int(-1)
+--- testing: '-7.7' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: 'abc' % '0' ---
+Exception: Modulo by zero
+--- testing: 'abc' % '65' ---
+int(0)
+--- testing: 'abc' % '-44' ---
+int(0)
+--- testing: 'abc' % '1.2' ---
+int(0)
+--- testing: 'abc' % '-7.7' ---
+int(0)
+--- testing: 'abc' % 'abc' ---
+Exception: Modulo by zero
+--- testing: 'abc' % '123abc' ---
+int(0)
+--- testing: 'abc' % '123e5' ---
+int(0)
+--- testing: 'abc' % '123e5xyz' ---
+int(0)
+--- testing: 'abc' % ' 123abc' ---
+int(0)
+--- testing: 'abc' % '123 abc' ---
+int(0)
+--- testing: 'abc' % '123abc ' ---
+int(0)
+--- testing: 'abc' % '3.4a' ---
+int(0)
+--- testing: 'abc' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '123abc' % '0' ---
+Exception: Modulo by zero
+--- testing: '123abc' % '65' ---
+int(58)
+--- testing: '123abc' % '-44' ---
+int(35)
+--- testing: '123abc' % '1.2' ---
+int(0)
+--- testing: '123abc' % '-7.7' ---
+int(4)
+--- testing: '123abc' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '123abc' % '123abc' ---
+int(0)
+--- testing: '123abc' % '123e5' ---
+int(123)
+--- testing: '123abc' % '123e5xyz' ---
+int(123)
+--- testing: '123abc' % ' 123abc' ---
+int(0)
+--- testing: '123abc' % '123 abc' ---
+int(0)
+--- testing: '123abc' % '123abc ' ---
+int(0)
+--- testing: '123abc' % '3.4a' ---
+int(0)
+--- testing: '123abc' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '123e5' % '0' ---
+Exception: Modulo by zero
+--- testing: '123e5' % '65' ---
+int(50)
+--- testing: '123e5' % '-44' ---
+int(20)
+--- testing: '123e5' % '1.2' ---
+int(0)
+--- testing: '123e5' % '-7.7' ---
+int(6)
+--- testing: '123e5' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '123e5' % '123abc' ---
+int(0)
+--- testing: '123e5' % '123e5' ---
+int(0)
+--- testing: '123e5' % '123e5xyz' ---
+int(0)
+--- testing: '123e5' % ' 123abc' ---
+int(0)
+--- testing: '123e5' % '123 abc' ---
+int(0)
+--- testing: '123e5' % '123abc ' ---
+int(0)
+--- testing: '123e5' % '3.4a' ---
+int(0)
+--- testing: '123e5' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '123e5xyz' % '0' ---
+Exception: Modulo by zero
+--- testing: '123e5xyz' % '65' ---
+int(50)
+--- testing: '123e5xyz' % '-44' ---
+int(20)
+--- testing: '123e5xyz' % '1.2' ---
+int(0)
+--- testing: '123e5xyz' % '-7.7' ---
+int(6)
+--- testing: '123e5xyz' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '123e5xyz' % '123abc' ---
+int(0)
+--- testing: '123e5xyz' % '123e5' ---
+int(0)
+--- testing: '123e5xyz' % '123e5xyz' ---
+int(0)
+--- testing: '123e5xyz' % ' 123abc' ---
+int(0)
+--- testing: '123e5xyz' % '123 abc' ---
+int(0)
+--- testing: '123e5xyz' % '123abc ' ---
+int(0)
+--- testing: '123e5xyz' % '3.4a' ---
+int(0)
+--- testing: '123e5xyz' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: ' 123abc' % '0' ---
+Exception: Modulo by zero
+--- testing: ' 123abc' % '65' ---
+int(58)
+--- testing: ' 123abc' % '-44' ---
+int(35)
+--- testing: ' 123abc' % '1.2' ---
+int(0)
+--- testing: ' 123abc' % '-7.7' ---
+int(4)
+--- testing: ' 123abc' % 'abc' ---
+Exception: Modulo by zero
+--- testing: ' 123abc' % '123abc' ---
+int(0)
+--- testing: ' 123abc' % '123e5' ---
+int(123)
+--- testing: ' 123abc' % '123e5xyz' ---
+int(123)
+--- testing: ' 123abc' % ' 123abc' ---
+int(0)
+--- testing: ' 123abc' % '123 abc' ---
+int(0)
+--- testing: ' 123abc' % '123abc ' ---
+int(0)
+--- testing: ' 123abc' % '3.4a' ---
+int(0)
+--- testing: ' 123abc' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '123 abc' % '0' ---
+Exception: Modulo by zero
+--- testing: '123 abc' % '65' ---
+int(58)
+--- testing: '123 abc' % '-44' ---
+int(35)
+--- testing: '123 abc' % '1.2' ---
+int(0)
+--- testing: '123 abc' % '-7.7' ---
+int(4)
+--- testing: '123 abc' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '123 abc' % '123abc' ---
+int(0)
+--- testing: '123 abc' % '123e5' ---
+int(123)
+--- testing: '123 abc' % '123e5xyz' ---
+int(123)
+--- testing: '123 abc' % ' 123abc' ---
+int(0)
+--- testing: '123 abc' % '123 abc' ---
+int(0)
+--- testing: '123 abc' % '123abc ' ---
+int(0)
+--- testing: '123 abc' % '3.4a' ---
+int(0)
+--- testing: '123 abc' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '123abc ' % '0' ---
+Exception: Modulo by zero
+--- testing: '123abc ' % '65' ---
+int(58)
+--- testing: '123abc ' % '-44' ---
+int(35)
+--- testing: '123abc ' % '1.2' ---
+int(0)
+--- testing: '123abc ' % '-7.7' ---
+int(4)
+--- testing: '123abc ' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '123abc ' % '123abc' ---
+int(0)
+--- testing: '123abc ' % '123e5' ---
+int(123)
+--- testing: '123abc ' % '123e5xyz' ---
+int(123)
+--- testing: '123abc ' % ' 123abc' ---
+int(0)
+--- testing: '123abc ' % '123 abc' ---
+int(0)
+--- testing: '123abc ' % '123abc ' ---
+int(0)
+--- testing: '123abc ' % '3.4a' ---
+int(0)
+--- testing: '123abc ' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: '3.4a' % '0' ---
+Exception: Modulo by zero
+--- testing: '3.4a' % '65' ---
+int(3)
+--- testing: '3.4a' % '-44' ---
+int(3)
+--- testing: '3.4a' % '1.2' ---
+int(0)
+--- testing: '3.4a' % '-7.7' ---
+int(3)
+--- testing: '3.4a' % 'abc' ---
+Exception: Modulo by zero
+--- testing: '3.4a' % '123abc' ---
+int(3)
+--- testing: '3.4a' % '123e5' ---
+int(3)
+--- testing: '3.4a' % '123e5xyz' ---
+int(3)
+--- testing: '3.4a' % ' 123abc' ---
+int(3)
+--- testing: '3.4a' % '123 abc' ---
+int(3)
+--- testing: '3.4a' % '123abc ' ---
+int(3)
+--- testing: '3.4a' % '3.4a' ---
+int(0)
+--- testing: '3.4a' % 'a5.9' ---
+Exception: Modulo by zero
+--- testing: 'a5.9' % '0' ---
+Exception: Modulo by zero
+--- testing: 'a5.9' % '65' ---
+int(0)
+--- testing: 'a5.9' % '-44' ---
+int(0)
+--- testing: 'a5.9' % '1.2' ---
+int(0)
+--- testing: 'a5.9' % '-7.7' ---
+int(0)
+--- testing: 'a5.9' % 'abc' ---
+Exception: Modulo by zero
+--- testing: 'a5.9' % '123abc' ---
+int(0)
+--- testing: 'a5.9' % '123e5' ---
+int(0)
+--- testing: 'a5.9' % '123e5xyz' ---
+int(0)
+--- testing: 'a5.9' % ' 123abc' ---
+int(0)
+--- testing: 'a5.9' % '123 abc' ---
+int(0)
+--- testing: 'a5.9' % '123abc ' ---
+int(0)
+--- testing: 'a5.9' % '3.4a' ---
+int(0)
+--- testing: 'a5.9' % 'a5.9' ---
+Exception: Modulo by zero
+===DONE===
---TEST--\r
-Test * operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($longVals as $longVal) {\r
- foreach($otherVals as $otherVal) {\r
- echo "--- testing: $longVal * $otherVal ---\n"; \r
- var_dump($longVal*$otherVal);\r
- }\r
-}\r
-\r
-foreach ($otherVals as $otherVal) {\r
- foreach($longVals as $longVal) {\r
- echo "--- testing: $otherVal * $longVal ---\n"; \r
- var_dump($otherVal*$longVal);\r
- }\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test * operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
+
+error_reporting(E_ERROR);
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal * $otherVal ---\n";
+ var_dump($longVal*$otherVal);
+ }
+}
+
+foreach ($otherVals as $otherVal) {
+ foreach($longVals as $longVal) {
+ echo "--- testing: $otherVal * $longVal ---\n";
+ var_dump($otherVal*$longVal);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: 9223372036854775807 * 0 ---
int(0)
--- testing: 9223372036854775807 * 1 ---
--- testing: 9223372036854775807 * -9223372036854775807 ---
float(-8.5070591730235E+37)
--- testing: 9223372036854775807 * -9.2233720368548E+18 ---
-float(-8.5070591730235E+37)\r
-===DONE===\r
+float(-8.5070591730235E+37)
+===DONE===
---TEST--\r
-Test * operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' * '$otherVal' ---\n"; \r
- var_dump($strVal*$otherVal);\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test * operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' * '$otherVal' ---\n";
+ var_dump($strVal*$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' * '0' ---
int(0)
--- testing: '0' * '65' ---
--- testing: 'a5.9' * '3.4a' ---
float(0)
--- testing: 'a5.9' * 'a5.9' ---
-int(0)\r
-===DONE===\r
+int(0)
+===DONE===
---TEST--\r
-Test -N operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-\r
-foreach ($longVals as $longVal) {\r
- echo "--- testing: $longVal ---\n";\r
- var_dump(-$longVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test -N operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(-$longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: 9223372036854775807 ---
int(-9223372036854775807)
--- testing: -9223372036854775808 ---
--- testing: -9223372036854775807 ---
int(9223372036854775807)
--- testing: -9.2233720368548E+18 ---
-float(9.2233720368548E+18)\r
-===DONE===\r
+float(9.2233720368548E+18)
+===DONE===
---TEST--\r
-Test -N operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-\r
-foreach ($strVals as $strVal) {\r
- echo "--- testing: '$strVal' ---\n";\r
- var_dump(-$strVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECTF--\r
+--TEST--
+Test -N operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ var_dump(-$strVal);
+}
+
+?>
+===DONE===
+--EXPECTF--
--- testing: '0' ---
int(0)
--- testing: '65' ---
--- testing: 'a5.9' ---
Warning: A non-numeric value encountered in %s on line %d
-int(0)\r
-===DONE===\r
+int(0)
+===DONE===
---TEST--\r
-Test == operator : different types\r
---FILE--\r
-<?php\r
-\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 679;\r
-$int2 = -67835;\r
-$valid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", +679);\r
-$valid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4);\r
-$invalid_int1 = array("6 7 9", "6y79", 678);\r
-$invalid_int2 = array("- 67835", "-67,835", "-67 835", "-678y35", -76834);\r
-\r
-$float1 = 57385.45835;\r
-$float2 = -67345.76567;\r
-$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4);\r
-$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4);\r
-$invalid_float1 = array("57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);\r
-$invalid_float2 = array("- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);\r
-\r
-\r
-$toCompare = array(\r
- true, $valid_true, $valid_false, \r
- false, $valid_false, $valid_true,\r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if ($typeToTest == $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTest' != '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- foreach($invalid_compares as $compareVal) {\r
- if ($typeToTest == $compareVal) {\r
- echo "FAILED: '$typeToTest' == '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test == operator : different types
+--FILE--
+<?php
+
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", +679);
+$valid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4);
+$invalid_int1 = array("6 7 9", "6y79", 678);
+$invalid_int2 = array("- 67835", "-67,835", "-67 835", "-678y35", -76834);
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4);
+$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4);
+$invalid_float1 = array("57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);
+$invalid_float2 = array("- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);
+
+
+$toCompare = array(
+ true, $valid_true, $valid_false,
+ false, $valid_false, $valid_true,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest == $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest == $compareVal) {
+ echo "FAILED: '$typeToTest' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test == operator : max int 32bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validEqual = array (\r
-MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0),\r
-MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),\r
-);\r
-\r
-$invalidEqual = array (\r
-MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),\r
-MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),\r
-);\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validEqual); $i +=2) {\r
- $typeToTestVal = $validEqual[$i];\r
- $compares = $validEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal == $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' != '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test invalid values\r
-for ($i = 0; $i < count($invalidEqual); $i +=2) {\r
- $typeToTestVal = $invalidEqual[$i];\r
- $compares = $invalidEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal == $compareVal) {\r
- echo "FAILED: '$typeToTestVal' == '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test == operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidEqual = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validEqual); $i +=2) {
+ $typeToTestVal = $validEqual[$i];
+ $compares = $validEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal == $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidEqual); $i +=2) {
+ $typeToTestVal = $invalidEqual[$i];
+ $compares = $invalidEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal == $compareVal) {
+ echo "FAILED: '$typeToTestVal' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test == operator : max int 64bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validEqual = array (\r
-MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),\r
-MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),\r
-);\r
-\r
-$invalidEqual = array (\r
-MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),\r
-MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),\r
-MAX_64Bit, array(MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit + 1),\r
-);\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validEqual); $i +=2) {\r
- $typeToTestVal = $validEqual[$i];\r
- $compares = $validEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal == $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' != '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test invalid values\r
-for ($i = 0; $i < count($invalidEqual); $i +=2) {\r
- $typeToTestVal = $invalidEqual[$i];\r
- $compares = $invalidEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal == $compareVal) {\r
- echo "FAILED: '$typeToTestVal' == '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test == operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),
+);
+
+$invalidEqual = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit + 1),
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validEqual); $i +=2) {
+ $typeToTestVal = $validEqual[$i];
+ $compares = $validEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal == $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidEqual); $i +=2) {
+ $typeToTestVal = $invalidEqual[$i];
+ $compares = $invalidEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal == $compareVal) {
+ echo "FAILED: '$typeToTestVal' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test > operator : different types\r
---FILE--\r
-<?php\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 679;\r
-$int2 = -67835;\r
-$valid_int1 = array("678", "678abc", " 678", "678 ", 678.0, 6.789E2, "+678", +678);\r
-$valid_int2 = array("-67836", "-67836abc", " -67836", "-67836 ", -67835.0001, -6.78351E4);\r
-$invalid_int1 = array(679, "679");\r
-$invalid_int2 = array(-67835, "-67835");\r
-\r
-$float1 = 57385.45835;\r
-$float2 = -67345.76567;\r
-$valid_float1 = array("57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);\r
-$valid_float2 = array("-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);\r
-$invalid_float1 = array(57385.45835, 5.738545835e4);\r
-$invalid_float2 = array(-67345.76567, -6.734576567E4);\r
-\r
-\r
-$toCompare = array(\r
-// boolean test will result in both sides being converted to boolean so !0 = true and true is not > true for example\r
-// also note that a string of "0" is converted to false but a string of "0.0" is converted to true\r
-// false cannot be tested as 0 can never be > 0 or 1\r
- true, $valid_false, $valid_true, \r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if ($typeToTest > $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTest' <= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- foreach($invalid_compares as $compareVal) {\r
- if ($typeToTest > $compareVal) {\r
- echo "FAILED: '$typeToTest' > '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test > operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("678", "678abc", " 678", "678 ", 678.0, 6.789E2, "+678", +678);
+$valid_int2 = array("-67836", "-67836abc", " -67836", "-67836 ", -67835.0001, -6.78351E4);
+$invalid_int1 = array(679, "679");
+$invalid_int2 = array(-67835, "-67835");
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);
+$valid_float2 = array("-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);
+$invalid_float1 = array(57385.45835, 5.738545835e4);
+$invalid_float2 = array(-67345.76567, -6.734576567E4);
+
+
+$toCompare = array(
+// boolean test will result in both sides being converted to boolean so !0 = true and true is not > true for example
+// also note that a string of "0" is converted to false but a string of "0.0" is converted to true
+// false cannot be tested as 0 can never be > 0 or 1
+ true, $valid_false, $valid_true,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest > $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest > $compareVal) {
+ echo "FAILED: '$typeToTest' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test >= operator : different types\r
---FILE--\r
-<?php\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 679;\r
-$int2 = -67835;\r
-$valid_int1 = array("679", "679abc", " 679", 679.0, 6.79E2, "678", "678abc", " 678", 678.0, 6.78E2, 6.789E2, "+678", +678);\r
-$valid_int2 = array("-67835", "-67835abc", " -67835", -67835.000, -6.7835E4, "-67836", "-67836abc". " -67836", -67835.0001, -6.78351E4, "-67836", -67835.0001, -6.78351E4);\r
-$invalid_int1 = array(680, "680");\r
-$invalid_int2 = array(-67834, "-67834");\r
-\r
-$float1 = 57385.45835;\r
-$float2 = -67345.76567;\r
-$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4, "57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);\r
-$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4, "-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);\r
-$invalid_float1 = array(57385.45836, 5.738545836e4);\r
-$invalid_float2 = array(-67345.76564, -6.734576564E4);\r
-\r
-$toCompare = array(\r
-\r
- true, array_merge($valid_false, $valid_true), NULL,\r
- false, $valid_false, $valid_true, \r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if ($typeToTest >= $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTest' < '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- if ($invalid_compares != NULL) {\r
- foreach($invalid_compares as $compareVal) {\r
- if ($typeToTest >= $compareVal) {\r
- echo "FAILED: '$typeToTest' >= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- }\r
- \r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test >= operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("679", "679abc", " 679", 679.0, 6.79E2, "678", "678abc", " 678", 678.0, 6.78E2, 6.789E2, "+678", +678);
+$valid_int2 = array("-67835", "-67835abc", " -67835", -67835.000, -6.7835E4, "-67836", "-67836abc". " -67836", -67835.0001, -6.78351E4, "-67836", -67835.0001, -6.78351E4);
+$invalid_int1 = array(680, "680");
+$invalid_int2 = array(-67834, "-67834");
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4, "57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);
+$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4, "-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);
+$invalid_float1 = array(57385.45836, 5.738545836e4);
+$invalid_float2 = array(-67345.76564, -6.734576564E4);
+
+$toCompare = array(
+
+ true, array_merge($valid_false, $valid_true), NULL,
+ false, $valid_false, $valid_true,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest >= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ if ($invalid_compares != NULL) {
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest >= $compareVal) {
+ echo "FAILED: '$typeToTest' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test >= operator : max int 32bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validGtOrEqual = array (\r
-MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit - 1),\r
-MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit - 1),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),\r
-);\r
-\r
-$invalidGtOrEqual = array (\r
-MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit + 1),\r
-MIN_32Bit, array(MIN_32Bit + 1,"-2147483646", -2.1474836460001e9)\r
-);\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validGtOrEqual); $i +=2) {\r
- $typeToTestVal = $validGtOrEqual[$i];\r
- $compares = $validGtOrEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal >= $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' < '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidGtOrEqual); $i +=2) {\r
- $typeToTestVal = $invalidGtOrEqual[$i];\r
- $compares = $invalidGtOrEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal >= $compareVal) {\r
- echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test >= operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validGtOrEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit - 1),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidGtOrEqual = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit + 1,"-2147483646", -2.1474836460001e9)
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validGtOrEqual); $i +=2) {
+ $typeToTestVal = $validGtOrEqual[$i];
+ $compares = $validGtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal >= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidGtOrEqual); $i +=2) {
+ $typeToTestVal = $invalidGtOrEqual[$i];
+ $compares = $invalidGtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal >= $compareVal) {
+ echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test >= operator : max int 64bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validGtOrEqual = array (\r
-MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit - 1),\r
-MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit - 1),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),\r
-);\r
-\r
-$invalidGtOrEqual = array (\r
-MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit + 1),\r
-MIN_32Bit, array(MIN_32Bit + 1,"-2147483646", -2.1474836460001e9)\r
-);\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validGtOrEqual); $i +=2) {\r
- $typeToTestVal = $validGtOrEqual[$i];\r
- $compares = $validGtOrEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal >= $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' < '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidGtOrEqual); $i +=2) {\r
- $typeToTestVal = $invalidGtOrEqual[$i];\r
- $compares = $invalidGtOrEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal >= $compareVal) {\r
- echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test >= operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validGtOrEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit - 1),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),
+);
+
+$invalidGtOrEqual = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit + 1,"-2147483646", -2.1474836460001e9)
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validGtOrEqual); $i +=2) {
+ $typeToTestVal = $validGtOrEqual[$i];
+ $compares = $validGtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal >= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidGtOrEqual); $i +=2) {
+ $typeToTestVal = $invalidGtOrEqual[$i];
+ $compares = $invalidGtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal >= $compareVal) {
+ echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test > operator : max int 32bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validGreaterThan = array (\r
-MAX_32Bit, array(MAX_32Bit - 1, "2147483646", "2147483646.999", 2.147483646e9, 2147483646.9, MIN_32Bit),\r
--2147483647, array(MIN_32Bit, "-2147483648", "-2147483647.001", -2.1474836471e9, -2147483647.9),\r
-);\r
-\r
-$invalidGreaterThan = array (\r
-MAX_32Bit, array(2e33, MAX_32Bit + 1),\r
-MIN_32Bit, array(MIN_32Bit + 1, MAX_32Bit)\r
-);\r
-\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validGreaterThan); $i +=2) {\r
- $typeToTestVal = $validGreaterThan[$i];\r
- $compares = $validGreaterThan[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal > $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidGreaterThan); $i +=2) {\r
- $typeToTestVal = $invalidGreaterThan[$i];\r
- $compares = $invalidGreaterThan[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal > $compareVal) {\r
- echo "FAILED: '$typeToTestVal' > '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test > operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validGreaterThan = array (
+MAX_32Bit, array(MAX_32Bit - 1, "2147483646", "2147483646.999", 2.147483646e9, 2147483646.9, MIN_32Bit),
+-2147483647, array(MIN_32Bit, "-2147483648", "-2147483647.001", -2.1474836471e9, -2147483647.9),
+);
+
+$invalidGreaterThan = array (
+MAX_32Bit, array(2e33, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit + 1, MAX_32Bit)
+);
+
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validGreaterThan); $i +=2) {
+ $typeToTestVal = $validGreaterThan[$i];
+ $compares = $validGreaterThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal > $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidGreaterThan); $i +=2) {
+ $typeToTestVal = $invalidGreaterThan[$i];
+ $compares = $invalidGreaterThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal > $compareVal) {
+ echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test > operator : max int 64bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validGreaterThan = array (\r
-MAX_32Bit, array(MAX_32Bit - 1, "2147483646", "2147483646.999", 2.147483646e9, 2147483646.9, MIN_32Bit),\r
--2147483647, array(MIN_32Bit, "-2147483648", "-2147483647.001", -2.1474836471e9, -2147483647.9),\r
-);\r
-\r
-$invalidGreaterThan = array (\r
-MAX_32Bit, array(2e33, MAX_32Bit + 1),\r
-MIN_32Bit, array(MIN_32Bit + 1, MAX_32Bit)\r
-);\r
-\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validGreaterThan); $i +=2) {\r
- $typeToTestVal = $validGreaterThan[$i];\r
- $compares = $validGreaterThan[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal > $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidGreaterThan); $i +=2) {\r
- $typeToTestVal = $invalidGreaterThan[$i];\r
- $compares = $invalidGreaterThan[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal > $compareVal) {\r
- echo "FAILED: '$typeToTestVal' > '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test > operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validGreaterThan = array (
+MAX_32Bit, array(MAX_32Bit - 1, "2147483646", "2147483646.999", 2.147483646e9, 2147483646.9, MIN_32Bit),
+-2147483647, array(MIN_32Bit, "-2147483648", "-2147483647.001", -2.1474836471e9, -2147483647.9),
+);
+
+$invalidGreaterThan = array (
+MAX_32Bit, array(2e33, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit + 1, MAX_32Bit)
+);
+
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validGreaterThan); $i +=2) {
+ $typeToTestVal = $validGreaterThan[$i];
+ $compares = $validGreaterThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal > $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidGreaterThan); $i +=2) {
+ $typeToTestVal = $invalidGreaterThan[$i];
+ $compares = $invalidGreaterThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal > $compareVal) {
+ echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test === operator : different types\r
---FILE--\r
-<?php\r
-\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 679;\r
-$int2 = -67835;\r
-$valid_int1 = array(679, +679);\r
-$valid_int2 = array(-67835);\r
-$invalid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", "6 7 9", "6y79", 678);\r
-$invalid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4, "- 67835", "-67,835", "-67 835", "-678y35", -76834);\r
-\r
-$float1 = 57385.45835;\r
-$float2 = -67345.76567;\r
-$valid_float1 = array(57385.45835, 5.738545835e4); \r
-$valid_float2 = array(-67345.76567, -6.734576567E4);\r
-$invalid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", "57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);\r
-$invalid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", "- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);\r
-\r
-\r
-$toCompare = array(\r
- true, array(true), array_merge($valid_true, $valid_false), \r
- false, array(false), array_merge($valid_true, $valid_false),\r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if ($typeToTest === $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTest' != '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- foreach($invalid_compares as $compareVal) {\r
- if ($typeToTest === $compareVal) {\r
- echo "FAILED: '$typeToTest' == '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test === operator : different types
+--FILE--
+<?php
+
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array(679, +679);
+$valid_int2 = array(-67835);
+$invalid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", "6 7 9", "6y79", 678);
+$invalid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4, "- 67835", "-67,835", "-67 835", "-678y35", -76834);
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array(57385.45835, 5.738545835e4);
+$valid_float2 = array(-67345.76567, -6.734576567E4);
+$invalid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", "57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);
+$invalid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", "- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);
+
+
+$toCompare = array(
+ true, array(true), array_merge($valid_true, $valid_false),
+ false, array(false), array_merge($valid_true, $valid_false),
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest === $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest === $compareVal) {
+ echo "FAILED: '$typeToTest' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test === operator : max int 32bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validIdentical = array (\r
-MAX_32Bit, array(MAX_32Bit),\r
-MIN_32Bit, array(MIN_32Bit),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),\r
-);\r
-\r
-$invalidIdentical = array (\r
-MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),\r
-MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),\r
-);\r
-\r
-\r
-$failed = false;\r
-// test for valid values\r
-for ($i = 0; $i < count($validIdentical); $i +=2) {\r
- $typeToTestVal = $validIdentical[$i];\r
- $compares = $validIdentical[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal === $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidIdentical); $i +=2) {\r
- $typeToTestVal = $invalidIdentical[$i];\r
- $compares = $invalidIdentical[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal === $compareVal) {\r
- echo "FAILED: '$typeToTestVal' === '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test === operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validIdentical = array (
+MAX_32Bit, array(MAX_32Bit),
+MIN_32Bit, array(MIN_32Bit),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidIdentical = array (
+MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+);
+
+
+$failed = false;
+// test for valid values
+for ($i = 0; $i < count($validIdentical); $i +=2) {
+ $typeToTestVal = $validIdentical[$i];
+ $compares = $validIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal === $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidIdentical); $i +=2) {
+ $typeToTestVal = $invalidIdentical[$i];
+ $compares = $invalidIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal === $compareVal) {
+ echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test === operator : max int 64bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validIdentical = array (\r
-MAX_32Bit, array(MAX_32Bit),\r
-MIN_32Bit, array(MIN_32Bit),\r
-MAX_64Bit, array(MAX_64Bit),\r
-MIN_64Bit, array(MIN_64Bit),\r
-);\r
-\r
-$invalidIdentical = array (\r
-MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),\r
-MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),\r
-MAX_64Bit, array(MAX_64Bit - 1, MAX_64Bit + 1),\r
-MIN_64Bit, array(MIN_64Bit + 1, MIN_64Bit - 1),\r
-);\r
-\r
-\r
-$failed = false;\r
-// test for valid values\r
-for ($i = 0; $i < count($validIdentical); $i +=2) {\r
- $typeToTestVal = $validIdentical[$i];\r
- $compares = $validIdentical[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal === $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidIdentical); $i +=2) {\r
- $typeToTestVal = $invalidIdentical[$i];\r
- $compares = $invalidIdentical[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal === $compareVal) {\r
- echo "FAILED: '$typeToTestVal' === '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test === operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validIdentical = array (
+MAX_32Bit, array(MAX_32Bit),
+MIN_32Bit, array(MIN_32Bit),
+MAX_64Bit, array(MAX_64Bit),
+MIN_64Bit, array(MIN_64Bit),
+);
+
+$invalidIdentical = array (
+MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit - 1, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit + 1, MIN_64Bit - 1),
+);
+
+
+$failed = false;
+// test for valid values
+for ($i = 0; $i < count($validIdentical); $i +=2) {
+ $typeToTestVal = $validIdentical[$i];
+ $compares = $validIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal === $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidIdentical); $i +=2) {
+ $typeToTestVal = $invalidIdentical[$i];
+ $compares = $invalidIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal === $compareVal) {
+ echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test < operator : different types\r
---FILE--\r
-<?php\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 677;\r
-$int2 = -67837;\r
-$valid_int1 = array("678", "678abc", " 678", "678 ", 678.0, 6.789E2, "+678", +678);\r
-$valid_int2 = array("-67836", "-67836abc", " -67836", "-67836 ", -67835.0001, -6.78351E4);\r
-$invalid_int1 = array(676, "676");\r
-$invalid_int2 = array(-67837, "-67837");\r
-\r
-$float1 = 57385.45835;\r
-$float2 = -67345.76567;\r
-$valid_float1 = array("57385.45836", "57385.45836aaa", " 57385.45836", 5.738545836e4);\r
-$valid_float2 = array("-67345.76566", "-67345.76566aaa", " -67345.76566", -6.734576566E4);\r
-$invalid_float1 = array(57385.45835, 5.738545835e4);\r
-$invalid_float2 = array(-67345.76567, -6.734576567E4);\r
-\r
-\r
-$toCompare = array(\r
- false, $valid_true, $valid_false, \r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if ($typeToTest < $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTest' >= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- foreach($invalid_compares as $compareVal) {\r
- if ($typeToTest < $compareVal) {\r
- echo "FAILED: '$typeToTest' < '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test < operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 677;
+$int2 = -67837;
+$valid_int1 = array("678", "678abc", " 678", "678 ", 678.0, 6.789E2, "+678", +678);
+$valid_int2 = array("-67836", "-67836abc", " -67836", "-67836 ", -67835.0001, -6.78351E4);
+$invalid_int1 = array(676, "676");
+$invalid_int2 = array(-67837, "-67837");
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45836", "57385.45836aaa", " 57385.45836", 5.738545836e4);
+$valid_float2 = array("-67345.76566", "-67345.76566aaa", " -67345.76566", -6.734576566E4);
+$invalid_float1 = array(57385.45835, 5.738545835e4);
+$invalid_float2 = array(-67345.76567, -6.734576567E4);
+
+
+$toCompare = array(
+ false, $valid_true, $valid_false,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest < $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest < $compareVal) {
+ echo "FAILED: '$typeToTest' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test <= operator : different types\r
---FILE--\r
-<?php\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 678;\r
-$int2 = -67836;\r
-$valid_int1 = array("679", "679abc", " 679", 679.0, 6.79E2, "678", "678abc", " 678", 678.0, 6.78E2, 6.789E2, "+678", +678);\r
-$valid_int2 = array("-67835", "-67835abc", " -67835", -67835.000, -6.7835E4, "-67836", "-67836abc". " -67836", -67835.0001, -6.78351E4, "-67836", -67835.0001, -6.78351E4);\r
-$invalid_int1 = array(677, "677");\r
-$invalid_int2 = array(-67874, "-67837");\r
-\r
-$float1 = 57385.45834;\r
-$float2 = -67345.76568;\r
-$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4, "57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);\r
-$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4, "-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);\r
-$invalid_float1 = array(57385.45833, 5.738545833e4);\r
-$invalid_float2 = array(-67345.76569, -6.734576569E4);\r
-\r
-$toCompare = array(\r
- true, $valid_true, $valid_false,\r
- false, array_merge($valid_false, $valid_true), NULL, \r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if ($typeToTest <= $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTest' > '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- if ($invalid_compares != NULL) {\r
- foreach($invalid_compares as $compareVal) {\r
- if ($typeToTest <= $compareVal) {\r
- echo "FAILED: '$typeToTest' <= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- }\r
- \r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test <= operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 678;
+$int2 = -67836;
+$valid_int1 = array("679", "679abc", " 679", 679.0, 6.79E2, "678", "678abc", " 678", 678.0, 6.78E2, 6.789E2, "+678", +678);
+$valid_int2 = array("-67835", "-67835abc", " -67835", -67835.000, -6.7835E4, "-67836", "-67836abc". " -67836", -67835.0001, -6.78351E4, "-67836", -67835.0001, -6.78351E4);
+$invalid_int1 = array(677, "677");
+$invalid_int2 = array(-67874, "-67837");
+
+$float1 = 57385.45834;
+$float2 = -67345.76568;
+$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4, "57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);
+$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4, "-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);
+$invalid_float1 = array(57385.45833, 5.738545833e4);
+$invalid_float2 = array(-67345.76569, -6.734576569E4);
+
+$toCompare = array(
+ true, $valid_true, $valid_false,
+ false, array_merge($valid_false, $valid_true), NULL,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest <= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ if ($invalid_compares != NULL) {
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest <= $compareVal) {
+ echo "FAILED: '$typeToTest' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test <= operator : max int 32bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validLtOrEqual = array (\r
-MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit + 1),\r
-MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit + 1),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),\r
-);\r
-\r
-$invalidLtOrEqual = array (\r
-MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),\r
-MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)\r
-);\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validLtOrEqual); $i +=2) {\r
- $typeToTestVal = $validLtOrEqual[$i];\r
- $compares = $validLtOrEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal <= $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' > '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test invalid values\r
-for ($i = 0; $i < count($invalidLtOrEqual); $i +=2) {\r
- $typeToTestVal = $invalidLtOrEqual[$i];\r
- $compares = $invalidLtOrEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal <= $compareVal) {\r
- echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test <= operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validLtOrEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidLtOrEqual = array (
+MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validLtOrEqual); $i +=2) {
+ $typeToTestVal = $validLtOrEqual[$i];
+ $compares = $validLtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal <= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidLtOrEqual); $i +=2) {
+ $typeToTestVal = $invalidLtOrEqual[$i];
+ $compares = $invalidLtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal <= $compareVal) {
+ echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test <= operator : max int 64bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validLtOrEqual = array (\r
-MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit + 1),\r
-MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit + 1),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),\r
-);\r
-\r
-$invalidLtOrEqual = array (\r
-MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),\r
-MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)\r
-);\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validLtOrEqual); $i +=2) {\r
- $typeToTestVal = $validLtOrEqual[$i];\r
- $compares = $validLtOrEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal <= $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' > '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test invalid values\r
-for ($i = 0; $i < count($invalidLtOrEqual); $i +=2) {\r
- $typeToTestVal = $invalidLtOrEqual[$i];\r
- $compares = $invalidLtOrEqual[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal <= $compareVal) {\r
- echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test <= operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validLtOrEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidLtOrEqual = array (
+MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validLtOrEqual); $i +=2) {
+ $typeToTestVal = $validLtOrEqual[$i];
+ $compares = $validLtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal <= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidLtOrEqual); $i +=2) {
+ $typeToTestVal = $invalidLtOrEqual[$i];
+ $compares = $invalidLtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal <= $compareVal) {
+ echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test < operator : max int 32bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validLessThan = array (\r
-2147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9),\r
-MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9),\r
-);\r
-\r
-$invalidLessThan = array (\r
-MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),\r
-MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)\r
-);\r
-\r
-$failed = false;\r
-// test for equality\r
-for ($i = 0; $i < count($validLessThan); $i +=2) {\r
- $typeToTestVal = $validLessThan[$i];\r
- $compares = $validLessThan[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal < $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidLessThan); $i +=2) {\r
- $typeToTestVal = $invalidLessThan[$i];\r
- $compares = $invalidLessThan[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal < $compareVal) {\r
- echo "FAILED: '$typeToTestVal' < '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test < operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validLessThan = array (
+2147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9),
+MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9),
+);
+
+$invalidLessThan = array (
+MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
+);
+
+$failed = false;
+// test for equality
+for ($i = 0; $i < count($validLessThan); $i +=2) {
+ $typeToTestVal = $validLessThan[$i];
+ $compares = $validLessThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal < $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidLessThan); $i +=2) {
+ $typeToTestVal = $invalidLessThan[$i];
+ $compares = $invalidLessThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal < $compareVal) {
+ echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test < operator : max int 64bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$validLessThan = array (\r
-2147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9),\r
-MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9),\r
-);\r
-\r
-$invalidLessThan = array (\r
-MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),\r
-MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)\r
-);\r
-\r
-$failed = false;\r
-// test for equality\r
-for ($i = 0; $i < count($validLessThan); $i +=2) {\r
- $typeToTestVal = $validLessThan[$i];\r
- $compares = $validLessThan[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal < $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidLessThan); $i +=2) {\r
- $typeToTestVal = $invalidLessThan[$i];\r
- $compares = $invalidLessThan[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal < $compareVal) {\r
- echo "FAILED: '$typeToTestVal' < '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test < operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validLessThan = array (
+2147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9),
+MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9),
+);
+
+$invalidLessThan = array (
+MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
+);
+
+$failed = false;
+// test for equality
+for ($i = 0; $i < count($validLessThan); $i +=2) {
+ $typeToTestVal = $validLessThan[$i];
+ $compares = $validLessThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal < $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidLessThan); $i +=2) {
+ $typeToTestVal = $invalidLessThan[$i];
+ $compares = $invalidLessThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal < $compareVal) {
+ echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test != operator : different types\r
---FILE--\r
-<?php\r
-\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 679;\r
-$int2 = -67835;\r
-$valid_int1 = array("6 7 9", "6y79", 678);\r
-$valid_int2 = array("- 67835", "-67,835", "-67 835", "-678y35", -76834);\r
-$invalid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", +679);\r
-$invalid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4);\r
-\r
-$float1 = 57385.45835;\r
-$float2 = -67345.76567;\r
-$valid_float1 = array("57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);\r
-$valid_float2 = array("- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);\r
-$invalid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4);\r
-$invalid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4);\r
-\r
-\r
-$toCompare = array(\r
- true, $valid_false, $valid_true, \r
- false, $valid_true, $valid_false,\r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if ($typeToTest != $compareVal && $typeToTest <> $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTest' == '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- foreach($invalid_compares as $compareVal) {\r
- if ($typeToTest != $compareVal || $typeToTest <> $compareVal) {\r
- echo "FAILED: '$typeToTest' != '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test != operator : different types
+--FILE--
+<?php
+
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("6 7 9", "6y79", 678);
+$valid_int2 = array("- 67835", "-67,835", "-67 835", "-678y35", -76834);
+$invalid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", +679);
+$invalid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4);
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);
+$valid_float2 = array("- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);
+$invalid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4);
+$invalid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4);
+
+
+$toCompare = array(
+ true, $valid_false, $valid_true,
+ false, $valid_true, $valid_false,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest != $compareVal && $typeToTest <> $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest != $compareVal || $typeToTest <> $compareVal) {
+ echo "FAILED: '$typeToTest' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test != operator : max int 32bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$invalidNotEquals = array (\r
-MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),\r
-MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),\r
-);\r
-\r
-$validNotEquals = array (\r
-MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),\r
-MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),\r
-);\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validNotEquals); $i +=2) {\r
- $typeToTestVal = $validNotEquals[$i];\r
- $compares = $validNotEquals[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal != $compareVal && $typeToTestVal != $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' == '$compareVal'\n";\r
- $failed = true;\r
- } \r
- }\r
-}\r
-// test invalid values\r
-for ($i = 0; $i < count($invalidNotEquals); $i +=2) {\r
- $typeToTestVal = $invalidNotEquals[$i];\r
- $compares = $invalidNotEquals[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal != $compareVal || $typeToTestVal != $compareVal) {\r
- echo "FAILED: '$typeToTestVal' != '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test != operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$invalidNotEquals = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$validNotEquals = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validNotEquals); $i +=2) {
+ $typeToTestVal = $validNotEquals[$i];
+ $compares = $validNotEquals[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal != $compareVal && $typeToTestVal != $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidNotEquals); $i +=2) {
+ $typeToTestVal = $invalidNotEquals[$i];
+ $compares = $invalidNotEquals[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal != $compareVal || $typeToTestVal != $compareVal) {
+ echo "FAILED: '$typeToTestVal' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test == operator : max int 64bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$invalidNotEquals = array (\r
-MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),\r
-MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),\r
-);\r
-\r
-$validNotEquals = array (\r
-MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),\r
-MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),\r
-MAX_64Bit, array(MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit + 1),\r
-);\r
-\r
-\r
-$failed = false;\r
-// test valid values\r
-for ($i = 0; $i < count($validNotEquals); $i +=2) {\r
- $typeToTestVal = $validNotEquals[$i];\r
- $compares = $validNotEquals[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal != $compareVal && $typeToTestVal <> $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' == '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test invalid values\r
-for ($i = 0; $i < count($invalidNotEquals); $i +=2) {\r
- $typeToTestVal = $invalidNotEquals[$i];\r
- $compares = $invalidNotEquals[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal != $compareVal || $typeToTestVal <> $compareVal) {\r
- echo "FAILED: '$typeToTestVal' != '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test == operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$invalidNotEquals = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),
+);
+
+$validNotEquals = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit + 1),
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validNotEquals); $i +=2) {
+ $typeToTestVal = $validNotEquals[$i];
+ $compares = $validNotEquals[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal != $compareVal && $typeToTestVal <> $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidNotEquals); $i +=2) {
+ $typeToTestVal = $invalidNotEquals[$i];
+ $compares = $invalidNotEquals[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal != $compareVal || $typeToTestVal <> $compareVal) {
+ echo "FAILED: '$typeToTestVal' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test !== operator : different types\r
---FILE--\r
-<?php\r
-\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 679;\r
-$int2 = -67835;\r
-$valid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", "6 7 9", "6y79", 678);\r
-$valid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4, "- 67835", "-67,835", "-67 835", "-678y35", -76834);\r
-$invalid_int1 = array(679, +679);\r
-$invalid_int2 = array(-67835);\r
-\r
-$float1 = 57385.45835;\r
-$float2 = -67345.76567;\r
-$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", "57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);\r
-$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", "- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);\r
-$invalid_float1 = array(57385.45835, 5.738545835e4); \r
-$invalid_float2 = array(-67345.76567, -6.734576567E4);\r
-\r
-\r
-$toCompare = array(\r
- true, array_merge($valid_true, $valid_false), array(true), \r
- false, array_merge($valid_true, $valid_false), array(false),\r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if ($typeToTest !== $compareVal) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTest' === '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- foreach($invalid_compares as $compareVal) {\r
- if ($typeToTest !== $compareVal) {\r
- echo "FAILED: '$typeToTest' !== '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test !== operator : different types
+--FILE--
+<?php
+
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", "6 7 9", "6y79", 678);
+$valid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4, "- 67835", "-67,835", "-67 835", "-678y35", -76834);
+$invalid_int1 = array(679, +679);
+$invalid_int2 = array(-67835);
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", "57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);
+$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", "- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);
+$invalid_float1 = array(57385.45835, 5.738545835e4);
+$invalid_float2 = array(-67345.76567, -6.734576567E4);
+
+
+$toCompare = array(
+ true, array_merge($valid_true, $valid_false), array(true),
+ false, array_merge($valid_true, $valid_false), array(false),
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest !== $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest !== $compareVal) {
+ echo "FAILED: '$typeToTest' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test !== operator : max int 32bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$invalidNotIdentical = array (\r
-MAX_32Bit, array(MAX_32Bit),\r
-MIN_32Bit, array(MIN_32Bit),\r
-MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),\r
-MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),\r
-);\r
-\r
-$validNotIdentical = array (\r
-MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),\r
-MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),\r
-);\r
-\r
-\r
-$failed = false;\r
-// test for valid values\r
-for ($i = 0; $i < count($validNotIdentical); $i +=2) {\r
- $typeToTestVal = $validNotIdentical[$i];\r
- $compares = $validNotIdentical[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal !== $compareVal) {\r
- //Do Nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' === '$compareVal'\n";\r
- $failed = true; \r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidNotIdentical); $i +=2) {\r
- $typeToTestVal = $invalidNotIdentical[$i];\r
- $compares = $invalidNotIdentical[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal !== $compareVal) {\r
- echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test !== operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$invalidNotIdentical = array (
+MAX_32Bit, array(MAX_32Bit),
+MIN_32Bit, array(MIN_32Bit),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$validNotIdentical = array (
+MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+);
+
+
+$failed = false;
+// test for valid values
+for ($i = 0; $i < count($validNotIdentical); $i +=2) {
+ $typeToTestVal = $validNotIdentical[$i];
+ $compares = $validNotIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal !== $compareVal) {
+ //Do Nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidNotIdentical); $i +=2) {
+ $typeToTestVal = $invalidNotIdentical[$i];
+ $compares = $invalidNotIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal !== $compareVal) {
+ echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test !== operator : max int 64bit range\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$invalidNotIdentical = array (\r
-MAX_32Bit, array(MAX_32Bit),\r
-MIN_32Bit, array(MIN_32Bit),\r
-MAX_64Bit, array(MAX_64Bit),\r
-MIN_64Bit, array(MIN_64Bit),\r
-);\r
-\r
-$validNotIdentical = array (\r
-MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),\r
-MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),\r
-MAX_64Bit, array(MAX_64Bit - 1, MAX_64Bit + 1),\r
-MIN_64Bit, array(MIN_64Bit + 1, MIN_64Bit - 1),\r
-);\r
-\r
-\r
-$failed = false;\r
-// test for valid values\r
-for ($i = 0; $i < count($validNotIdentical); $i +=2) {\r
- $typeToTestVal = $validNotIdentical[$i];\r
- $compares = $validNotIdentical[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal !== $compareVal) {\r
- //Do Nothing\r
- }\r
- else {\r
- echo "FAILED: '$typeToTestVal' === '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-// test for invalid values\r
-for ($i = 0; $i < count($invalidNotIdentical); $i +=2) {\r
- $typeToTestVal = $invalidNotIdentical[$i];\r
- $compares = $invalidNotIdentical[$i + 1];\r
- foreach($compares as $compareVal) {\r
- if ($typeToTestVal !== $compareVal) {\r
- echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";\r
- $failed = true;\r
- }\r
- }\r
-}\r
-\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test !== operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$invalidNotIdentical = array (
+MAX_32Bit, array(MAX_32Bit),
+MIN_32Bit, array(MIN_32Bit),
+MAX_64Bit, array(MAX_64Bit),
+MIN_64Bit, array(MIN_64Bit),
+);
+
+$validNotIdentical = array (
+MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit - 1, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit + 1, MIN_64Bit - 1),
+);
+
+
+$failed = false;
+// test for valid values
+for ($i = 0; $i < count($validNotIdentical); $i +=2) {
+ $typeToTestVal = $validNotIdentical[$i];
+ $compares = $validNotIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal !== $compareVal) {
+ //Do Nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidNotIdentical); $i +=2) {
+ $typeToTestVal = $invalidNotIdentical[$i];
+ $compares = $invalidNotIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal !== $compareVal) {
+ echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test <=> operator : different types\r
---FILE--\r
-<?php\r
-$valid_true = array(1, "1", "true", 1.0, array(1));\r
-$valid_false = array(0, "", 0.0, array(), NULL);\r
-\r
-$int1 = 679;\r
-$int2 = -67835;\r
-$valid_int1 = array("678", "678abc", " 678", "678 ", 678.0, 6.789E2, "+678", +678);\r
-$valid_int2 = array("-67836", "-67836abc", " -67836", "-67836 ", -67835.0001, -6.78351E4);\r
-$invalid_int1 = array(679, "679");\r
-$invalid_int2 = array(-67835, "-67835");\r
-\r
-$float1 = 57385.45835;\r
-$float2 = -67345.76567;\r
-$valid_float1 = array("57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);\r
-$valid_float2 = array("-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);\r
-$invalid_float1 = array(57385.45835, 5.738545835e4);\r
-$invalid_float2 = array(-67345.76567, -6.734576567E4);\r
-\r
-\r
-$toCompare = array(\r
-// boolean test will result in both sides being converted to boolean so !0 = true and true is not > true for example\r
-// also note that a string of "0" is converted to false but a string of "0.0" is converted to true\r
-// false cannot be tested as 0 can never be > 0 or 1\r
- true, $valid_false, $valid_true, \r
- $int1, $valid_int1, $invalid_int1,\r
- $int2, $valid_int2, $invalid_int2,\r
- $float1, $valid_float1, $invalid_float1,\r
- $float2, $valid_float2, $invalid_float2\r
-);\r
- \r
-$failed = false;\r
-for ($i = 0; $i < count($toCompare); $i +=3) {\r
- $typeToTest = $toCompare[$i];\r
- $valid_compares = $toCompare[$i + 1];\r
- $invalid_compares = $toCompare[$i + 2];\r
- \r
- foreach($valid_compares as $compareVal) {\r
- if (($typeToTest <=> $compareVal) === 1) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: ('$typeToTest' <=> '$compareVal') !== 1\n";\r
- $failed = true;\r
- }\r
- if (($compareVal <=> $typeToTest) === -1) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: ('$compareVal' <=> '$typeToTest') !== -1\n";\r
- $failed = true;\r
- }\r
- if (($compareVal <=> $compareVal) === 0) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: ('$compareVal' <=> '$compareVal') !== 0\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- foreach($invalid_compares as $compareVal) {\r
- if (($typeToTest <=> $compareVal) === 1) {\r
- echo "FAILED: ('$typeToTest' <=> '$compareVal') === 1\n";\r
- $failed = true;\r
- }\r
- if (($compareVal <=> $typeToTest) === -1) {\r
- echo "FAILED: ('$compareVal' <=> '$typeToTest') === -1\n";\r
- $failed = true;\r
- }\r
- if (($compareVal <=> $compareVal) !== 0) {\r
- echo "FAILED: ('$compareVal' <=> '$compareVal') !== 0\n";\r
- $failed = true;\r
- }\r
- }\r
- \r
- if (($typeToTest <=> $typeToTest) === 0) {\r
- // do nothing\r
- }\r
- else {\r
- echo "FAILED: ('$typeToTest' <=> '$typeToTest') !== 0\n";\r
- $failed = true;\r
- }\r
-}\r
-if ($failed == false) {\r
- echo "Test Passed\n";\r
-}\r
-?>\r
-===DONE===\r
---EXPECT--\r
-Test Passed\r
+--TEST--
+Test <=> operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("678", "678abc", " 678", "678 ", 678.0, 6.789E2, "+678", +678);
+$valid_int2 = array("-67836", "-67836abc", " -67836", "-67836 ", -67835.0001, -6.78351E4);
+$invalid_int1 = array(679, "679");
+$invalid_int2 = array(-67835, "-67835");
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);
+$valid_float2 = array("-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);
+$invalid_float1 = array(57385.45835, 5.738545835e4);
+$invalid_float2 = array(-67345.76567, -6.734576567E4);
+
+
+$toCompare = array(
+// boolean test will result in both sides being converted to boolean so !0 = true and true is not > true for example
+// also note that a string of "0" is converted to false but a string of "0.0" is converted to true
+// false cannot be tested as 0 can never be > 0 or 1
+ true, $valid_false, $valid_true,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if (($typeToTest <=> $compareVal) === 1) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: ('$typeToTest' <=> '$compareVal') !== 1\n";
+ $failed = true;
+ }
+ if (($compareVal <=> $typeToTest) === -1) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: ('$compareVal' <=> '$typeToTest') !== -1\n";
+ $failed = true;
+ }
+ if (($compareVal <=> $compareVal) === 0) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: ('$compareVal' <=> '$compareVal') !== 0\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if (($typeToTest <=> $compareVal) === 1) {
+ echo "FAILED: ('$typeToTest' <=> '$compareVal') === 1\n";
+ $failed = true;
+ }
+ if (($compareVal <=> $typeToTest) === -1) {
+ echo "FAILED: ('$compareVal' <=> '$typeToTest') === -1\n";
+ $failed = true;
+ }
+ if (($compareVal <=> $compareVal) !== 0) {
+ echo "FAILED: ('$compareVal' <=> '$compareVal') !== 0\n";
+ $failed = true;
+ }
+ }
+
+ if (($typeToTest <=> $typeToTest) === 0) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: ('$typeToTest' <=> '$typeToTest') !== 0\n";
+ $failed = true;
+ }
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
===DONE===
---TEST--\r
-Test N-- operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-\r
-foreach ($longVals as $longVal) {\r
- echo "--- testing: $longVal ---\n";\r
- $longVal--;\r
- var_dump($longVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
---- testing: 9223372036854775807 ---\r
-int(9223372036854775806)\r
---- testing: -9223372036854775808 ---\r
-float(-9.2233720368548E+18)\r
---- testing: 2147483647 ---\r
-int(2147483646)\r
---- testing: -2147483648 ---\r
-int(-2147483649)\r
---- testing: 9223372034707292160 ---\r
-int(9223372034707292159)\r
---- testing: -9223372034707292160 ---\r
-int(-9223372034707292161)\r
---- testing: 2147483648 ---\r
-int(2147483647)\r
---- testing: -2147483649 ---\r
-int(-2147483650)\r
---- testing: 4294967294 ---\r
-int(4294967293)\r
---- testing: 4294967295 ---\r
-int(4294967294)\r
---- testing: 4294967293 ---\r
-int(4294967292)\r
---- testing: 9223372036854775806 ---\r
-int(9223372036854775805)\r
---- testing: 9.2233720368548E+18 ---\r
-float(9.2233720368548E+18)\r
---- testing: -9223372036854775807 ---\r
-int(-9223372036854775808)\r
---- testing: -9.2233720368548E+18 ---\r
-float(-9.2233720368548E+18)\r
-===DONE===\r
+--TEST--
+Test N-- operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ $longVal--;
+ var_dump($longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+int(9223372036854775806)
+--- testing: -9223372036854775808 ---
+float(-9.2233720368548E+18)
+--- testing: 2147483647 ---
+int(2147483646)
+--- testing: -2147483648 ---
+int(-2147483649)
+--- testing: 9223372034707292160 ---
+int(9223372034707292159)
+--- testing: -9223372034707292160 ---
+int(-9223372034707292161)
+--- testing: 2147483648 ---
+int(2147483647)
+--- testing: -2147483649 ---
+int(-2147483650)
+--- testing: 4294967294 ---
+int(4294967293)
+--- testing: 4294967295 ---
+int(4294967294)
+--- testing: 4294967293 ---
+int(4294967292)
+--- testing: 9223372036854775806 ---
+int(9223372036854775805)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+int(-9223372036854775808)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
---TEST--\r
-Test N-- operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-\r
-foreach ($strVals as $strVal) {\r
- echo "--- testing: '$strVal' ---\n";\r
- $strVal--;\r
- var_dump($strVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
---- testing: '0' ---\r
-int(-1)\r
---- testing: '65' ---\r
-int(64)\r
---- testing: '-44' ---\r
-int(-45)\r
---- testing: '1.2' ---\r
-float(0.2)\r
---- testing: '-7.7' ---\r
-float(-8.7)\r
---- testing: 'abc' ---\r
-string(3) "abc"\r
---- testing: '123abc' ---\r
-string(6) "123abc"\r
---- testing: '123e5' ---\r
-float(12299999)\r
---- testing: '123e5xyz' ---\r
-string(8) "123e5xyz"\r
---- testing: ' 123abc' ---\r
-string(7) " 123abc"\r
---- testing: '123 abc' ---\r
-string(7) "123 abc"\r
---- testing: '123abc ' ---\r
-string(7) "123abc "\r
---- testing: '3.4a' ---\r
-string(4) "3.4a"\r
---- testing: 'a5.9' ---\r
-string(4) "a5.9"\r
-===DONE===\r
+--TEST--
+Test N-- operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ $strVal--;
+ var_dump($strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' ---
+int(-1)
+--- testing: '65' ---
+int(64)
+--- testing: '-44' ---
+int(-45)
+--- testing: '1.2' ---
+float(0.2)
+--- testing: '-7.7' ---
+float(-8.7)
+--- testing: 'abc' ---
+string(3) "abc"
+--- testing: '123abc' ---
+string(6) "123abc"
+--- testing: '123e5' ---
+float(12299999)
+--- testing: '123e5xyz' ---
+string(8) "123e5xyz"
+--- testing: ' 123abc' ---
+string(7) " 123abc"
+--- testing: '123 abc' ---
+string(7) "123 abc"
+--- testing: '123abc ' ---
+string(7) "123abc "
+--- testing: '3.4a' ---
+string(4) "3.4a"
+--- testing: 'a5.9' ---
+string(4) "a5.9"
+===DONE===
---TEST--\r
-Test N++ operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-\r
-foreach ($longVals as $longVal) {\r
- echo "--- testing: $longVal ---\n";\r
- $longVal++;\r
- var_dump($longVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
---- testing: 9223372036854775807 ---\r
-float(9.2233720368548E+18)\r
---- testing: -9223372036854775808 ---\r
-int(-9223372036854775807)\r
---- testing: 2147483647 ---\r
-int(2147483648)\r
---- testing: -2147483648 ---\r
-int(-2147483647)\r
---- testing: 9223372034707292160 ---\r
-int(9223372034707292161)\r
---- testing: -9223372034707292160 ---\r
-int(-9223372034707292159)\r
---- testing: 2147483648 ---\r
-int(2147483649)\r
---- testing: -2147483649 ---\r
-int(-2147483648)\r
---- testing: 4294967294 ---\r
-int(4294967295)\r
---- testing: 4294967295 ---\r
-int(4294967296)\r
---- testing: 4294967293 ---\r
-int(4294967294)\r
---- testing: 9223372036854775806 ---\r
-int(9223372036854775807)\r
---- testing: 9.2233720368548E+18 ---\r
-float(9.2233720368548E+18)\r
---- testing: -9223372036854775807 ---\r
-int(-9223372036854775806)\r
---- testing: -9.2233720368548E+18 ---\r
-float(-9.2233720368548E+18)\r
-===DONE===\r
+--TEST--
+Test N++ operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ $longVal++;
+ var_dump($longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808 ---
+int(-9223372036854775807)
+--- testing: 2147483647 ---
+int(2147483648)
+--- testing: -2147483648 ---
+int(-2147483647)
+--- testing: 9223372034707292160 ---
+int(9223372034707292161)
+--- testing: -9223372034707292160 ---
+int(-9223372034707292159)
+--- testing: 2147483648 ---
+int(2147483649)
+--- testing: -2147483649 ---
+int(-2147483648)
+--- testing: 4294967294 ---
+int(4294967295)
+--- testing: 4294967295 ---
+int(4294967296)
+--- testing: 4294967293 ---
+int(4294967294)
+--- testing: 9223372036854775806 ---
+int(9223372036854775807)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+int(-9223372036854775806)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
---TEST--\r
-Test N++ operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-\r
-foreach ($strVals as $strVal) {\r
- echo "--- testing: '$strVal' ---\n";\r
- $strVal++;\r
- var_dump($strVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
---- testing: '0' ---\r
-int(1)\r
---- testing: '65' ---\r
-int(66)\r
---- testing: '-44' ---\r
-int(-43)\r
---- testing: '1.2' ---\r
-float(2.2)\r
---- testing: '-7.7' ---\r
-float(-6.7)\r
---- testing: 'abc' ---\r
-string(3) "abd"\r
---- testing: '123abc' ---\r
-string(6) "123abd"\r
---- testing: '123e5' ---\r
-float(12300001)\r
---- testing: '123e5xyz' ---\r
-string(8) "123e5xza"\r
---- testing: ' 123abc' ---\r
-string(7) " 123abd"\r
---- testing: '123 abc' ---\r
-string(7) "123 abd"\r
---- testing: '123abc ' ---\r
-string(7) "123abc "\r
---- testing: '3.4a' ---\r
-string(4) "3.4b"\r
---- testing: 'a5.9' ---\r
-string(4) "a5.0"\r
-===DONE===\r
+--TEST--
+Test N++ operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ $strVal++;
+ var_dump($strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' ---
+int(1)
+--- testing: '65' ---
+int(66)
+--- testing: '-44' ---
+int(-43)
+--- testing: '1.2' ---
+float(2.2)
+--- testing: '-7.7' ---
+float(-6.7)
+--- testing: 'abc' ---
+string(3) "abd"
+--- testing: '123abc' ---
+string(6) "123abd"
+--- testing: '123e5' ---
+float(12300001)
+--- testing: '123e5xyz' ---
+string(8) "123e5xza"
+--- testing: ' 123abc' ---
+string(7) " 123abd"
+--- testing: '123 abc' ---
+string(7) "123 abd"
+--- testing: '123abc ' ---
+string(7) "123abc "
+--- testing: '3.4a' ---
+string(4) "3.4b"
+--- testing: 'a5.9' ---
+string(4) "a5.0"
+===DONE===
---TEST--\r
-Test --N operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-\r
-foreach ($longVals as $longVal) {\r
- echo "--- testing: $longVal ---\n";\r
- var_dump(--$longVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test --N operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(--$longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: 9223372036854775807 ---
int(9223372036854775806)
--- testing: -9223372036854775808 ---
--- testing: -9223372036854775807 ---
int(-9223372036854775808)
--- testing: -9.2233720368548E+18 ---
-float(-9.2233720368548E+18)\r
-===DONE===\r
+float(-9.2233720368548E+18)
+===DONE===
---TEST--\r
-Test --N operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-\r
-foreach ($strVals as $strVal) {\r
- echo "--- testing: '$strVal' ---\n";\r
- var_dump(--$strVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test --N operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ var_dump(--$strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' ---
int(-1)
--- testing: '65' ---
--- testing: '3.4a' ---
string(4) "3.4a"
--- testing: 'a5.9' ---
-string(4) "a5.9"\r
-===DONE===\r
+string(4) "a5.9"
+===DONE===
---TEST--\r
-Test ++N operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-\r
-foreach ($longVals as $longVal) {\r
- echo "--- testing: $longVal ---\n";\r
- var_dump(++$longVal);\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test ++N operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(++$longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: 9223372036854775807 ---
float(9.2233720368548E+18)
--- testing: -9223372036854775808 ---
--- testing: -9223372036854775807 ---
int(-9223372036854775806)
--- testing: -9.2233720368548E+18 ---
-float(-9.2233720368548E+18)\r
-===DONE===\r
+float(-9.2233720368548E+18)
+===DONE===
---TEST--\r
-Test - operator : 64bit long tests\r
---SKIPIF--\r
-<?php\r
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");\r
-?>\r
---FILE--\r
-<?php\r
- \r
-define("MAX_64Bit", 9223372036854775807);\r
-define("MAX_32Bit", 2147483647);\r
-define("MIN_64Bit", -9223372036854775807 - 1);\r
-define("MIN_32Bit", -2147483647 - 1);\r
-\r
-$longVals = array(\r
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,\r
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, \r
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1\r
-);\r
-\r
-$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($longVals as $longVal) {\r
- foreach($otherVals as $otherVal) {\r
- echo "--- testing: $longVal - $otherVal ---\n"; \r
- var_dump($longVal-$otherVal);\r
- }\r
-}\r
-\r
-foreach ($otherVals as $otherVal) {\r
- foreach($longVals as $longVal) {\r
- echo "--- testing: $otherVal - $longVal ---\n"; \r
- var_dump($otherVal-$longVal);\r
- }\r
-}\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test - operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
+
+error_reporting(E_ERROR);
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal - $otherVal ---\n";
+ var_dump($longVal-$otherVal);
+ }
+}
+
+foreach ($otherVals as $otherVal) {
+ foreach($longVals as $longVal) {
+ echo "--- testing: $otherVal - $longVal ---\n";
+ var_dump($otherVal-$longVal);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: 9223372036854775807 - 0 ---
int(9223372036854775807)
--- testing: 9223372036854775807 - 1 ---
--- testing: 9223372036854775807 - -9223372036854775807 ---
float(1.844674407371E+19)
--- testing: 9223372036854775807 - -9.2233720368548E+18 ---
-float(1.844674407371E+19)\r
-===DONE===\r
+float(1.844674407371E+19)
+===DONE===
---TEST--\r
-Test - operator : various numbers as strings\r
---FILE--\r
-<?php\r
-\r
-$strVals = array(\r
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",\r
- "a5.9"\r
-);\r
-\r
-error_reporting(E_ERROR);\r
-\r
-foreach ($strVals as $strVal) {\r
- foreach($strVals as $otherVal) {\r
- echo "--- testing: '$strVal' - '$otherVal' ---\n"; \r
- var_dump($strVal-$otherVal);\r
- }\r
-}\r
-\r
- \r
-?>\r
-===DONE===\r
---EXPECT--\r
+--TEST--
+Test - operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' - '$otherVal' ---\n";
+ var_dump($strVal-$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' - '0' ---
int(0)
--- testing: '0' - '65' ---
--- testing: 'a5.9' - '3.4a' ---
float(-3.4)
--- testing: 'a5.9' - 'a5.9' ---
-int(0)\r
-===DONE===\r
+int(0)
+===DONE===
---TEST--\r
-Returning a reference from a function\r
---FILE--\r
-<?php\r
-\r
-function &returnByRef(&$arg1)\r
-{\r
- return $arg1;\r
-}\r
-\r
-$a = 7;\r
-$b =& returnByRef($a);\r
-var_dump($b);\r
-$a++;\r
-var_dump($b);\r
-\r
-?>\r
---EXPECT--\r
-int(7)\r
+--TEST--
+Returning a reference from a function
+--FILE--
+<?php
+
+function &returnByRef(&$arg1)
+{
+ return $arg1;
+}
+
+$a = 7;
+$b =& returnByRef($a);
+var_dump($b);
+$a++;
+var_dump($b);
+
+?>
+--EXPECT--
+int(7)
int(8)
---TEST--\r
-Returning a reference from a function.\r
---FILE--\r
-<?php\r
-function &returnRef() {\r
- global $a;\r
- return $a;\r
-}\r
-\r
-function returnVal() {\r
- global $a;\r
- return $a;\r
-}\r
-\r
-$a = "original";\r
-$b =& returnVal();\r
-$b = "changed";\r
-var_dump($a); //expecting warning + "original" \r
-\r
-$a = "original";\r
-$b =& returnRef();\r
-$b = "changed";\r
-var_dump($a); //expecting "changed" \r
-?>\r
---EXPECTF--\r
-\r
-Notice: Only variables should be assigned by reference in %s on line 13\r
-string(8) "original"\r
-string(7) "changed"\r
+--TEST--
+Returning a reference from a function.
+--FILE--
+<?php
+function &returnRef() {
+ global $a;
+ return $a;
+}
+
+function returnVal() {
+ global $a;
+ return $a;
+}
+
+$a = "original";
+$b =& returnVal();
+$b = "changed";
+var_dump($a); //expecting warning + "original"
+
+$a = "original";
+$b =& returnRef();
+$b = "changed";
+var_dump($a); //expecting "changed"
+?>
+--EXPECTF--
+
+Notice: Only variables should be assigned by reference in %s on line 13
+string(8) "original"
+string(7) "changed"
---TEST--\r
-Returning a reference from a function\r
---FILE--\r
-<?php\r
-function returnConstantByValue() {\r
- return 100;\r
-}\r
-\r
-function &returnConstantByRef() {\r
- return 100;\r
-}\r
-\r
-function &returnVariableByRef() {\r
- return $GLOBALS['a'];\r
-}\r
-\r
-echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &returnConstantByValue();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &returnConstantByRef();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &returnVariableByRef();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-?>\r
---EXPECTF--\r
-\r
----> 1. Trying to assign by reference the return value of a function that returns by value:\r
-\r
-Notice: Only variables should be assigned by reference in %s on line 17\r
-int(5)\r
-int(100)\r
-\r
----> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 7\r
-int(5)\r
-int(100)\r
-\r
----> 3. Trying to assign by reference the return value of a function that returns by ref:\r
-int(5)\r
-int(5)\r
+--TEST--
+Returning a reference from a function
+--FILE--
+<?php
+function returnConstantByValue() {
+ return 100;
+}
+
+function &returnConstantByRef() {
+ return 100;
+}
+
+function &returnVariableByRef() {
+ return $GLOBALS['a'];
+}
+
+echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnConstantByValue();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnConstantByRef();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnVariableByRef();
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Trying to assign by reference the return value of a function that returns by value:
+
+Notice: Only variables should be assigned by reference in %s on line 17
+int(5)
+int(100)
+
+---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 7
+int(5)
+int(100)
+
+---> 3. Trying to assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
---TEST--\r
-Returning a reference from a static method\r
---FILE--\r
-<?php\r
-Class C {\r
- static function returnConstantByValue() {\r
- return 100;\r
- }\r
-\r
- static function &returnConstantByRef() {\r
- return 100;\r
- }\r
- \r
- static function &returnVariableByRef() {\r
- return $GLOBALS['a'];\r
- }\r
-}\r
-\r
-echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &C::returnConstantByValue();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &C::returnConstantByRef();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &C::returnVariableByRef();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-?>\r
---EXPECTF--\r
-\r
----> 1. Trying to assign by reference the return value of a function that returns by value:\r
-\r
-Notice: Only variables should be assigned by reference in %s on line 19\r
-int(5)\r
-int(100)\r
-\r
----> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 8\r
-int(5)\r
-int(100)\r
-\r
----> 3. Trying to assign by reference the return value of a function that returns by ref:\r
-int(5)\r
-int(5)\r
+--TEST--
+Returning a reference from a static method
+--FILE--
+<?php
+Class C {
+ static function returnConstantByValue() {
+ return 100;
+ }
+
+ static function &returnConstantByRef() {
+ return 100;
+ }
+
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
+}
+
+echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnConstantByValue();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnConstantByRef();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnVariableByRef();
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Trying to assign by reference the return value of a function that returns by value:
+
+Notice: Only variables should be assigned by reference in %s on line 19
+int(5)
+int(100)
+
+---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 8
+int(5)
+int(100)
+
+---> 3. Trying to assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
---TEST--\r
-Returning a reference from a method\r
---FILE--\r
-<?php\r
-Class C {\r
- function returnConstantByValue() {\r
- return 100;\r
- }\r
- \r
- function &returnConstantByRef() {\r
- return 100;\r
- }\r
- \r
- static function &returnVariableByRef() {\r
- return $GLOBALS['a'];\r
- }\r
-}\r
-$c = new C;\r
-\r
-echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &$c->returnConstantByValue();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &$c->returnConstantByRef();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &$c->returnVariableByRef();\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-?>\r
---EXPECTF--\r
-\r
----> 1. Trying to assign by reference the return value of a function that returns by value:\r
-\r
-Notice: Only variables should be assigned by reference in %s on line 20\r
-int(5)\r
-int(100)\r
-\r
----> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 8\r
-int(5)\r
-int(100)\r
-\r
----> 3. Trying to assign by reference the return value of a function that returns by ref:\r
-int(5)\r
-int(5)\r
+--TEST--
+Returning a reference from a method
+--FILE--
+<?php
+Class C {
+ function returnConstantByValue() {
+ return 100;
+ }
+
+ function &returnConstantByRef() {
+ return 100;
+ }
+
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
+}
+$c = new C;
+
+echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnConstantByValue();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnConstantByRef();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnVariableByRef();
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Trying to assign by reference the return value of a function that returns by value:
+
+Notice: Only variables should be assigned by reference in %s on line 20
+int(5)
+int(100)
+
+---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 8
+int(5)
+int(100)
+
+---> 3. Trying to assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
---TEST--\r
-Returning a reference from a function via another function\r
---INI--\r
-error_reporting = E_ALL & ~E_STRICT\r
---FILE--\r
-<?php\r
-function returnConstantByValue() {\r
- return 100;\r
-}\r
-\r
-function &returnConstantByRef() {\r
- return 100;\r
-}\r
-\r
-function &returnVariableByRef() {\r
- return $GLOBALS['a'];\r
-}\r
-\r
-function &returnFunctionCallByRef($functionToCall) {\r
- return $functionToCall();\r
-}\r
-\r
-echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &returnFunctionCallByRef('returnConstantByValue');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &returnFunctionCallByRef('returnConstantByRef');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &returnFunctionCallByRef('returnVariableByRef');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-?>\r
---EXPECTF--\r
----> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 15\r
-int(5)\r
-int(100)\r
-\r
----> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 7\r
-int(5)\r
-int(100)\r
-\r
----> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\r
-int(5)\r
-int(5)\r
+--TEST--
+Returning a reference from a function via another function
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+function returnConstantByValue() {
+ return 100;
+}
+
+function &returnConstantByRef() {
+ return 100;
+}
+
+function &returnVariableByRef() {
+ return $GLOBALS['a'];
+}
+
+function &returnFunctionCallByRef($functionToCall) {
+ return $functionToCall();
+}
+
+echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnFunctionCallByRef('returnConstantByValue');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnFunctionCallByRef('returnConstantByRef');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnFunctionCallByRef('returnVariableByRef');
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:
+
+Notice: Only variable references should be returned by reference in %s on line 15
+int(5)
+int(100)
+
+---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 7
+int(5)
+int(100)
+
+---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
---TEST--\r
-Returning a reference from a static method via another static method\r
---INI--\r
-error_reporting = E_ALL & ~E_STRICT\r
---FILE--\r
-<?php\r
-class C {\r
- static function returnConstantByValue() {\r
- return 100;\r
- }\r
- \r
- static function &returnConstantByRef() {\r
- return 100;\r
- }\r
- \r
- static function &returnVariableByRef() {\r
- return $GLOBALS['a'];\r
- }\r
- \r
- static function &returnFunctionCallByRef($functionToCall) {\r
- return C::$functionToCall();\r
- }\r
-}\r
-\r
-echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &C::returnFunctionCallByRef('returnConstantByValue');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &C::returnFunctionCallByRef('returnConstantByRef');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &C::returnFunctionCallByRef('returnVariableByRef');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-?>\r
---EXPECTF--\r
-\r
----> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 16\r
-int(5)\r
-int(100)\r
-\r
----> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 8\r
-int(5)\r
-int(100)\r
-\r
----> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\r
-int(5)\r
+--TEST--
+Returning a reference from a static method via another static method
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+class C {
+ static function returnConstantByValue() {
+ return 100;
+ }
+
+ static function &returnConstantByRef() {
+ return 100;
+ }
+
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
+
+ static function &returnFunctionCallByRef($functionToCall) {
+ return C::$functionToCall();
+ }
+}
+
+echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnFunctionCallByRef('returnConstantByValue');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnFunctionCallByRef('returnConstantByRef');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnFunctionCallByRef('returnVariableByRef');
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:
+
+Notice: Only variable references should be returned by reference in %s on line 16
+int(5)
+int(100)
+
+---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 8
+int(5)
+int(100)
+
+---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:
+int(5)
int(5)
---TEST--\r
-Returning a reference from a non-static method via another non-static method\r
---INI--\r
-error_reporting = E_ALL & ~E_STRICT\r
---FILE--\r
-<?php\r
-class C {\r
- function returnConstantByValue() {\r
- return 100;\r
- }\r
- \r
- function &returnConstantByRef() {\r
- return 100;\r
- }\r
- \r
- function &returnVariableByRef() {\r
- return $GLOBALS['a'];\r
- }\r
- \r
- function &returnFunctionCallByRef($functionToCall) {\r
- return $this->$functionToCall();\r
- }\r
-}\r
-$c = new C;\r
-\r
-echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &$c->returnFunctionCallByRef('returnConstantByValue');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &$c->returnFunctionCallByRef('returnConstantByRef');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";\r
-unset($a, $b);\r
-$a = 4;\r
-$b = &$c->returnFunctionCallByRef('returnVariableByRef');\r
-$a++;\r
-var_dump($a, $b);\r
-\r
-?>\r
---EXPECTF--\r
-\r
----> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 16\r
-int(5)\r
-int(100)\r
-\r
----> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line 8\r
-int(5)\r
-int(100)\r
-\r
----> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\r
-int(5)\r
+--TEST--
+Returning a reference from a non-static method via another non-static method
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+class C {
+ function returnConstantByValue() {
+ return 100;
+ }
+
+ function &returnConstantByRef() {
+ return 100;
+ }
+
+ function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
+
+ function &returnFunctionCallByRef($functionToCall) {
+ return $this->$functionToCall();
+ }
+}
+$c = new C;
+
+echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnFunctionCallByRef('returnConstantByValue');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnFunctionCallByRef('returnConstantByRef');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnFunctionCallByRef('returnVariableByRef');
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:
+
+Notice: Only variable references should be returned by reference in %s on line 16
+int(5)
+int(100)
+
+---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 8
+int(5)
+int(100)
+
+---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:
+int(5)
int(5)
---TEST--\r
-Returning a references returned by another function\r
---FILE--\r
-<?php\r
-\r
-\r
-function &returnVarByRef () {\r
- $b=1;\r
- return $b; \r
-}\r
-\r
-function &testReturnVarByRef() {\r
- return returnVarByRef();\r
-}\r
-\r
-function returnVal () {\r
-return 1; \r
-}\r
-\r
-function &testReturnValByRef() {\r
- return returnVal();\r
-}\r
-\r
-echo "\n---> 1. Return a variable by reference -> No warning:\n";\r
-\r
-var_dump (testReturnVarByRef());\r
-\r
-echo "\n---> 2. Return a value by reference -> Warning:\n";\r
-\r
-var_dump (testReturnValByRef());\r
-\r
---EXPECTF--\r
----> 1. Return a variable by reference -> No warning:\r
-int(1)\r
-\r
----> 2. Return a value by reference -> Warning:\r
-\r
-Notice: Only variable references should be returned by reference in %s on line %d\r
-int(1)\r
+--TEST--
+Returning a references returned by another function
+--FILE--
+<?php
+
+
+function &returnVarByRef () {
+ $b=1;
+ return $b;
+}
+
+function &testReturnVarByRef() {
+ return returnVarByRef();
+}
+
+function returnVal () {
+return 1;
+}
+
+function &testReturnValByRef() {
+ return returnVal();
+}
+
+echo "\n---> 1. Return a variable by reference -> No warning:\n";
+
+var_dump (testReturnVarByRef());
+
+echo "\n---> 2. Return a value by reference -> Warning:\n";
+
+var_dump (testReturnValByRef());
+
+--EXPECTF--
+---> 1. Return a variable by reference -> No warning:
+int(1)
+
+---> 2. Return a value by reference -> Warning:
+
+Notice: Only variable references should be returned by reference in %s on line %d
+int(1)
-/*\r
- +----------------------------------------------------------------------+\r
- | PHP Version 7 |\r
- +----------------------------------------------------------------------+\r
- | Copyright (c) 1997-2018 The PHP Group |\r
- +----------------------------------------------------------------------+\r
- | This source file is subject to version 3.01 of the PHP license, |\r
- | that is bundled with this package in the file LICENSE, and is |\r
- | available through the world-wide-web at the following url: |\r
- | http://www.php.net/license/3_01.txt |\r
- | If you did not receive a copy of the PHP license and are unable to |\r
- | obtain it through the world-wide-web, please send a note to |\r
- | license@php.net so we can mail you a copy immediately. |\r
- +----------------------------------------------------------------------+\r
- | Author: Wez Furlong <wez@thebrainroom.com> |\r
- +----------------------------------------------------------------------+\r
-*/\r
-\r
-/* $Id: buildconf.js,v 1.13.2.2.2.1.2.5 2009-01-02 12:18:21 kalle Exp $ */\r
-// This generates a configure script for win32 build\r
-\r
-WScript.StdOut.WriteLine("Rebuilding configure.js");\r
-var FSO = WScript.CreateObject("Scripting.FileSystemObject");\r
-var C = FSO.CreateTextFile("configure.js", true);\r
-var B = FSO.CreateTextFile("configure.bat", true);\r
-\r
-var modules = "";\r
-var MODULES = WScript.CreateObject("Scripting.Dictionary");\r
-var module_dirs = new Array();\r
-\r
-function file_get_contents(filename)\r
-{\r
- var F = FSO.OpenTextFile(filename, 1);\r
- var t = F.ReadAll();\r
- F.Close();\r
- return t;\r
-}\r
-\r
-function Module_Item(module_name, config_path, dir_line, deps, content)\r
-{\r
- this.module_name = module_name;\r
- this.config_path = config_path;\r
- this.dir_line = dir_line;\r
- this.deps = deps;\r
- this.content = content;\r
-}\r
-\r
-function find_config_w32(dirname)\r
-{\r
- if (!FSO.FolderExists(dirname)) {\r
- return;\r
- }\r
-\r
- var f = FSO.GetFolder(dirname);\r
- var fc = new Enumerator(f.SubFolders);\r
- var c, i, ok, n;\r
- var item = null;\r
- var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");\r
- \r
- for (; !fc.atEnd(); fc.moveNext())\r
- {\r
- ok = true;\r
- /* check if we already picked up a module with the same dirname;\r
- * if we have, don't include it here */\r
- n = FSO.GetFileName(fc.item());\r
- \r
- if (n == '.svn' || n == 'tests')\r
- continue;\r
- \r
- // WScript.StdOut.WriteLine("checking " + dirname + "/" + n);\r
- if (MODULES.Exists(n)) {\r
- WScript.StdOut.WriteLine("Skipping " + dirname + "/" + n + " -- already have a module with that name");\r
- continue;\r
- }\r
-\r
- c = FSO.BuildPath(fc.item(), "config.w32");\r
- if (FSO.FileExists(c)) {\r
-// WScript.StdOut.WriteLine(c);\r
-\r
- var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"\r
- + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";\r
- var contents = file_get_contents(c);\r
- var deps = new Array();\r
-\r
- // parse out any deps from the file\r
- var calls = contents.match(re_dep_line);\r
- if (calls != null) {\r
- for (i = 0; i < calls.length; i++) {\r
- // now we need the extension name out of this thing\r
- if (calls[i].match(re_dep_line)) {\r
-// WScript.StdOut.WriteLine("n depends on " + RegExp.$1);\r
- deps[deps.length] = RegExp.$1;\r
-\r
- }\r
- }\r
- }\r
-\r
- item = new Module_Item(n, c, dir_line, deps, contents);\r
- MODULES.Add(n, item);\r
- }\r
- }\r
-}\r
-\r
-// Emit core modules array. This is used by a snapshot\r
-// build to override a default "yes" value so that external\r
-// modules don't break the build by becoming statically compiled\r
-function emit_core_module_list()\r
-{\r
- var module_names = (new VBArray(MODULES.Keys())).toArray();\r
- var i, mod_name, j;\r
- var item;\r
- var output = "";\r
-\r
- C.WriteLine("core_module_list = new Array(");\r
-\r
- // first, look for modules with empty deps; emit those first\r
- for (i in module_names) {\r
- mod_name = module_names[i];\r
- C.WriteLine("\"" + mod_name.replace(/_/g, "-") + "\",");\r
- }\r
-\r
- C.WriteLine("false // dummy");\r
-\r
- C.WriteLine(");");\r
-}\r
-\r
-\r
-function emit_module(item)\r
-{\r
- return item.dir_line + item.content;\r
-}\r
-\r
-function emit_dep_modules(module_names)\r
-{\r
- var i, mod_name, j;\r
- var output = "";\r
- var item = null;\r
-\r
- for (i in module_names) {\r
- mod_name = module_names[i];\r
-\r
- if (MODULES.Exists(mod_name)) {\r
- item = MODULES.Item(mod_name);\r
- MODULES.Remove(mod_name);\r
- if (item.deps.length) {\r
- output += emit_dep_modules(item.deps);\r
- }\r
- output += emit_module(item);\r
- }\r
- }\r
-\r
- return output;\r
-}\r
-\r
-function gen_modules()\r
-{\r
- var module_names = (new VBArray(MODULES.Keys())).toArray();\r
- var i, mod_name, j;\r
- var item;\r
- var output = "";\r
-\r
- // first, look for modules with empty deps; emit those first\r
- for (i in module_names) {\r
- mod_name = module_names[i];\r
- item = MODULES.Item(mod_name);\r
- if (item.deps.length == 0) {\r
- MODULES.Remove(mod_name);\r
- output += emit_module(item);\r
- }\r
- }\r
-\r
- // now we are left with modules that have dependencies on other modules\r
- module_names = (new VBArray(MODULES.Keys())).toArray();\r
- output += emit_dep_modules(module_names);\r
-\r
- return output;\r
-}\r
-\r
-// Process buildconf arguments\r
-function buildconf_process_args()\r
-{\r
- args = WScript.Arguments;\r
-\r
- for (i = 0; i < args.length; i++) {\r
- arg = args(i);\r
- // If it is --foo=bar, split on the equals sign\r
- arg = arg.split("=", 2);\r
- argname = arg[0];\r
- if (arg.length > 1) {\r
- argval = arg[1];\r
- } else {\r
- argval = null;\r
- }\r
-\r
- if (argname == '--add-modules-dir' && argval != null) {\r
- WScript.StdOut.WriteLine("Adding " + argval + " to the module search path");\r
- module_dirs[module_dirs.length] = argval;\r
- }\r
- }\r
-}\r
-\r
-buildconf_process_args();\r
-\r
-// Write the head of the configure script\r
-C.WriteLine("/* This file automatically generated from win32/build/confutils.js */");\r
-C.WriteLine("MODE_PHPIZE=false;");\r
-C.Write(file_get_contents("win32/build/confutils.js"));\r
-\r
-// Pull in code from sapi and extensions\r
-modules = file_get_contents("win32/build/config.w32");\r
-\r
-// Pick up confs from TSRM and Zend if present\r
-find_config_w32(".");\r
-find_config_w32("sapi");\r
-find_config_w32("ext");\r
-emit_core_module_list();\r
-\r
-// If we have not specified any module dirs let's add some defaults\r
-if (module_dirs.length == 0) {\r
- find_config_w32("pecl");\r
- find_config_w32("..\\pecl");\r
- find_config_w32("pecl\\rpc");\r
- find_config_w32("..\\pecl\\rpc");\r
-} else {\r
- for (i = 0; i < module_dirs.length; i++) {\r
- find_config_w32(module_dirs[i]);\r
- }\r
-}\r
-\r
-// Now generate contents of module based on MODULES, chasing dependencies\r
-// to ensure that dependent modules are emitted first\r
-modules += gen_modules();\r
-\r
-// Look for ARG_ENABLE or ARG_WITH calls\r
-re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");\r
-calls = modules.match(re);\r
-for (i = 0; i < calls.length; i++) {\r
- item = calls[i];\r
- C.WriteLine("try {");\r
- C.WriteLine(item);\r
- C.WriteLine("} catch (e) {");\r
- C.WriteLine('\tSTDOUT.WriteLine("problem: " + e);');\r
- C.WriteLine("}");\r
-}\r
-\r
-C.WriteBlankLines(1);\r
-C.WriteLine("STDOUT.WriteLine(\"PHP Version: \" + PHP_VERSION_STRING);");\r
-C.WriteLine("STDOUT.WriteBlankLines(1);");\r
-C.WriteLine("conf_process_args();");\r
-C.WriteBlankLines(1);\r
-\r
-// Comment out the calls from their original positions\r
-modules = modules.replace(re, "/* $1 */");\r
-C.Write(modules);\r
-\r
-C.WriteBlankLines(1);\r
-C.Write(file_get_contents("win32/build/configure.tail"));\r
-\r
-B.WriteLine("@echo off");\r
-B.WriteLine("cscript /nologo configure.js %*");\r
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 7 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2018 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: buildconf.js,v 1.13.2.2.2.1.2.5 2009-01-02 12:18:21 kalle Exp $ */
+// This generates a configure script for win32 build
+
+WScript.StdOut.WriteLine("Rebuilding configure.js");
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var C = FSO.CreateTextFile("configure.js", true);
+var B = FSO.CreateTextFile("configure.bat", true);
+
+var modules = "";
+var MODULES = WScript.CreateObject("Scripting.Dictionary");
+var module_dirs = new Array();
+
+function file_get_contents(filename)
+{
+ var F = FSO.OpenTextFile(filename, 1);
+ var t = F.ReadAll();
+ F.Close();
+ return t;
+}
+
+function Module_Item(module_name, config_path, dir_line, deps, content)
+{
+ this.module_name = module_name;
+ this.config_path = config_path;
+ this.dir_line = dir_line;
+ this.deps = deps;
+ this.content = content;
+}
+
+function find_config_w32(dirname)
+{
+ if (!FSO.FolderExists(dirname)) {
+ return;
+ }
+
+ var f = FSO.GetFolder(dirname);
+ var fc = new Enumerator(f.SubFolders);
+ var c, i, ok, n;
+ var item = null;
+ var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
+
+ for (; !fc.atEnd(); fc.moveNext())
+ {
+ ok = true;
+ /* check if we already picked up a module with the same dirname;
+ * if we have, don't include it here */
+ n = FSO.GetFileName(fc.item());
+
+ if (n == '.svn' || n == 'tests')
+ continue;
+
+ // WScript.StdOut.WriteLine("checking " + dirname + "/" + n);
+ if (MODULES.Exists(n)) {
+ WScript.StdOut.WriteLine("Skipping " + dirname + "/" + n + " -- already have a module with that name");
+ continue;
+ }
+
+ c = FSO.BuildPath(fc.item(), "config.w32");
+ if (FSO.FileExists(c)) {
+// WScript.StdOut.WriteLine(c);
+
+ var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"
+ + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";
+ var contents = file_get_contents(c);
+ var deps = new Array();
+
+ // parse out any deps from the file
+ var calls = contents.match(re_dep_line);
+ if (calls != null) {
+ for (i = 0; i < calls.length; i++) {
+ // now we need the extension name out of this thing
+ if (calls[i].match(re_dep_line)) {
+// WScript.StdOut.WriteLine("n depends on " + RegExp.$1);
+ deps[deps.length] = RegExp.$1;
+
+ }
+ }
+ }
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+ }
+}
+
+// Emit core modules array. This is used by a snapshot
+// build to override a default "yes" value so that external
+// modules don't break the build by becoming statically compiled
+function emit_core_module_list()
+{
+ var module_names = (new VBArray(MODULES.Keys())).toArray();
+ var i, mod_name, j;
+ var item;
+ var output = "";
+
+ C.WriteLine("core_module_list = new Array(");
+
+ // first, look for modules with empty deps; emit those first
+ for (i in module_names) {
+ mod_name = module_names[i];
+ C.WriteLine("\"" + mod_name.replace(/_/g, "-") + "\",");
+ }
+
+ C.WriteLine("false // dummy");
+
+ C.WriteLine(");");
+}
+
+
+function emit_module(item)
+{
+ return item.dir_line + item.content;
+}
+
+function emit_dep_modules(module_names)
+{
+ var i, mod_name, j;
+ var output = "";
+ var item = null;
+
+ for (i in module_names) {
+ mod_name = module_names[i];
+
+ if (MODULES.Exists(mod_name)) {
+ item = MODULES.Item(mod_name);
+ MODULES.Remove(mod_name);
+ if (item.deps.length) {
+ output += emit_dep_modules(item.deps);
+ }
+ output += emit_module(item);
+ }
+ }
+
+ return output;
+}
+
+function gen_modules()
+{
+ var module_names = (new VBArray(MODULES.Keys())).toArray();
+ var i, mod_name, j;
+ var item;
+ var output = "";
+
+ // first, look for modules with empty deps; emit those first
+ for (i in module_names) {
+ mod_name = module_names[i];
+ item = MODULES.Item(mod_name);
+ if (item.deps.length == 0) {
+ MODULES.Remove(mod_name);
+ output += emit_module(item);
+ }
+ }
+
+ // now we are left with modules that have dependencies on other modules
+ module_names = (new VBArray(MODULES.Keys())).toArray();
+ output += emit_dep_modules(module_names);
+
+ return output;
+}
+
+// Process buildconf arguments
+function buildconf_process_args()
+{
+ args = WScript.Arguments;
+
+ for (i = 0; i < args.length; i++) {
+ arg = args(i);
+ // If it is --foo=bar, split on the equals sign
+ arg = arg.split("=", 2);
+ argname = arg[0];
+ if (arg.length > 1) {
+ argval = arg[1];
+ } else {
+ argval = null;
+ }
+
+ if (argname == '--add-modules-dir' && argval != null) {
+ WScript.StdOut.WriteLine("Adding " + argval + " to the module search path");
+ module_dirs[module_dirs.length] = argval;
+ }
+ }
+}
+
+buildconf_process_args();
+
+// Write the head of the configure script
+C.WriteLine("/* This file automatically generated from win32/build/confutils.js */");
+C.WriteLine("MODE_PHPIZE=false;");
+C.Write(file_get_contents("win32/build/confutils.js"));
+
+// Pull in code from sapi and extensions
+modules = file_get_contents("win32/build/config.w32");
+
+// Pick up confs from TSRM and Zend if present
+find_config_w32(".");
+find_config_w32("sapi");
+find_config_w32("ext");
+emit_core_module_list();
+
+// If we have not specified any module dirs let's add some defaults
+if (module_dirs.length == 0) {
+ find_config_w32("pecl");
+ find_config_w32("..\\pecl");
+ find_config_w32("pecl\\rpc");
+ find_config_w32("..\\pecl\\rpc");
+} else {
+ for (i = 0; i < module_dirs.length; i++) {
+ find_config_w32(module_dirs[i]);
+ }
+}
+
+// Now generate contents of module based on MODULES, chasing dependencies
+// to ensure that dependent modules are emitted first
+modules += gen_modules();
+
+// Look for ARG_ENABLE or ARG_WITH calls
+re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");
+calls = modules.match(re);
+for (i = 0; i < calls.length; i++) {
+ item = calls[i];
+ C.WriteLine("try {");
+ C.WriteLine(item);
+ C.WriteLine("} catch (e) {");
+ C.WriteLine('\tSTDOUT.WriteLine("problem: " + e);');
+ C.WriteLine("}");
+}
+
+C.WriteBlankLines(1);
+C.WriteLine("STDOUT.WriteLine(\"PHP Version: \" + PHP_VERSION_STRING);");
+C.WriteLine("STDOUT.WriteBlankLines(1);");
+C.WriteLine("conf_process_args();");
+C.WriteBlankLines(1);
+
+// Comment out the calls from their original positions
+modules = modules.replace(re, "/* $1 */");
+C.Write(modules);
+
+C.WriteBlankLines(1);
+C.Write(file_get_contents("win32/build/configure.tail"));
+
+B.WriteLine("@echo off");
+B.WriteLine("cscript /nologo configure.js %*");
-REGEDIT4\r
-\r
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.3.99-dev]\r
-"TypesSupported"=dword:00000007\r
-"EventMessageFile"="g:\\test\\srctrunkinstall\\php7ts.dll"\r
+REGEDIT4
+
+[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.3.99-dev]
+"TypesSupported"=dword:00000007
+"EventMessageFile"="g:\\test\\srctrunkinstall\\php7ts.dll"