]> granicus.if.org Git - php/commitdiff
Convert CRLF line endings to LF
authorPeter Kokot <peterkokot@gmail.com>
Sat, 13 Oct 2018 09:21:27 +0000 (11:21 +0200)
committerPeter Kokot <peterkokot@gmail.com>
Sat, 13 Oct 2018 09:21:27 +0000 (11:21 +0200)
This patch simplifies line endings tracked in the Git repository and
syncs them to all include the LF style instead of the CRLF files.

Newline characters:
- LF (\n) (*nix and Mac)
- CRLF (\r\n) (Windows)
- CR (\r) (old Mac, obsolete)

To see which line endings are in the index and in the working copy the
following command can be used:
`git ls-files --eol`

Git additionally provides `.gitattributes` file to specify if some files
need to have specific line endings on all platforms (either CRLF or LF).

Changed files shouldn't cause issues on modern Windows platforms because
also Git can do output conversion is core.autocrlf=true is set on
Windows and use CRLF newlines in all files in the working tree.

Unless CRLF files are tracked specifically, Git by default tracks all
files in the index using LF newlines.

210 files changed:
Zend/tests/bug55509.phpt
Zend/tests/bug64979.phpt
Zend/tests/bug71474.phpt
Zend/tests/bug72918.phpt
Zend/tests/str_offset_002.phpt
Zend/tests/traits/bugs/case-sensitive.phpt
Zend/tests/traits/static_001.phpt
Zend/tests/traits/static_002.phpt
Zend/tests/traits/static_003.phpt
Zend/tests/traits/static_004.phpt
Zend/tests/traits/static_forward_static_call.phpt
Zend/tests/traits/static_get_called_class.phpt
Zend/tests/traits/trait_constant_001.phpt
Zend/tests/traits/trait_constant_002.phpt
ext/curl/tests/curl_version_error.phpt
ext/curl/tests/curl_version_variation1.phpt
ext/filter/tests/bug47435.phpt
ext/filter/tests/bug49274.phpt
ext/gd/tests/bug42434.phpt
ext/gd/tests/bug47946.phpt
ext/gd/tests/bug52070.phpt
ext/gd/tests/bug53156.phpt
ext/gd/tests/bug72494.phpt
ext/gd/tests/bug73272.phpt
ext/gd/tests/bug73279.phpt
ext/gd/tests/bug73279_old.phpt
ext/gd/tests/bug73968.phpt
ext/gd/tests/func.inc
ext/gd/tests/imagecrop_auto-ext.phpt
ext/gd/tests/imagecrop_auto.phpt
ext/gd/tests/imageellipse_error8.phpt
ext/gd/tests/imagefilltoborder_error7.phpt
ext/gd/tests/imageflip.phpt
ext/gd/tests/imagerectangle_basic.phpt
ext/gd/tests/imagerectangle_error1.phpt
ext/gd/tests/imagerectangle_error2.phpt
ext/gd/tests/imagerectangle_error3.phpt
ext/gd/tests/imagerectangle_error4.phpt
ext/gd/tests/imagerectangle_error5.phpt
ext/gd/tests/imagerectangle_error6.phpt
ext/gd/tests/imagerectangle_error7.phpt
ext/gd/tests/imagerectangle_error8.phpt
ext/gd/tests/test_image_equals_file_palette.phpt
ext/gd/tests/webp_basic.phpt
ext/intl/tests/calendar_getDayOfWeekType_basic.phpt
ext/intl/tests/calendar_getNow_basic.phpt
ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt
ext/intl/tests/dateformat_formatObject_calendar.phpt
ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt
ext/intl/tests/dateformat_formatObject_datetime.phpt
ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt
ext/intl/tests/dateformat_formatObject_error.phpt
ext/intl/tests/resourcebundle.build
ext/intl/tests/timezone_createDefault_basic.phpt
ext/intl/tests/timezone_getCanonicalID_variant1.phpt
ext/intl/tests/timezone_getDisplayName_variant4.phpt
ext/mbstring/tests/bug52981.phpt
ext/mbstring/tests/bug75944.phpt
ext/mcrypt/tests/bug55169.phpt
ext/mysqli/tests/bug53503.phpt
ext/mysqli/tests/bug55653.phpt
ext/mysqli/tests/bug55859.phpt
ext/mysqli/tests/bug62046.phpt
ext/mysqli/tests/bug62885.phpt
ext/pcre/tests/bug69864.phpt
ext/pcre/tests/bug73612.phpt
ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
ext/pgsql/tests/30nb_async_query_params.phpt
ext/phar/tests/bug53872.phpt
ext/phar/tests/phar_gobyebye-win32.phpt
ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt
ext/reflection/tests/ReflectionParameter_isDefault.phpt
ext/session/mod_files.bat
ext/session/tests/bug36459.phpt
ext/sockets/tests/bug51958.phpt
ext/sockets/tests/mcast_ipv4_recv.phpt
ext/sockets/tests/mcast_ipv6_recv.phpt
ext/sockets/tests/mcast_ipv6_recv_limited.phpt
ext/sockets/tests/mcast_ipv6_send.phpt
ext/spl/tests/DirectoryIterator_getInode_basic.phpt
ext/spl/tests/DirectoryIterator_getInode_error.phpt
ext/spl/tests/SplFileInfo_getGroup_error.phpt
ext/spl/tests/SplFileInfo_getInode_basic.phpt
ext/spl/tests/SplFileInfo_getInode_error.phpt
ext/spl/tests/SplFileInfo_getOwner_error.phpt
ext/spl/tests/SplFileInfo_getPerms_basic.phpt
ext/spl/tests/SplFileInfo_getPerms_error.phpt
ext/spl/tests/bug73629.phpt
ext/spl/tests/bug74478.phpt
ext/spl/tests/iterator_069.phpt
ext/spl/tests/iterator_070.phpt
ext/spl/tests/iterator_071.phpt
ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt
ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt
ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt
ext/sqlite3/tests/bug73333.phpt
ext/standard/tests/file/bug43353-win32.phpt
ext/standard/tests/file/bug49047.phpt
ext/standard/tests/file/bug53241.phpt
ext/standard/tests/file/bug55124.phpt
ext/standard/tests/file/bug60120.phpt
ext/standard/tests/file/rename_variation8-win32.phpt
ext/standard/tests/file/stream_enclosed.phpt
ext/standard/tests/file/windows_links/bug48746.phpt
ext/standard/tests/file/windows_links/bug48746_1.phpt
ext/standard/tests/file/windows_links/bug48746_2.phpt
ext/standard/tests/file/windows_links/bug48746_3.phpt
ext/standard/tests/file/windows_links/bug73962.phpt
ext/standard/tests/general_functions/bug50690.phpt
ext/standard/tests/general_functions/get_defined_constants_basic.phpt
ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
ext/standard/tests/general_functions/uniqid_error.phpt
ext/standard/tests/mail/bug73203.phpt
ext/standard/tests/network/gethostbyname_basic003.phpt
ext/standard/tests/network/gethostbynamel_basic1.phpt
ext/standard/tests/streams/bug49936_win32.phpt
ext/standard/tests/streams/bug74090.phpt
ext/standard/tests/strings/bug50052.phpt
ext/standard/tests/strings/bug53021.phpt
ext/standard/tests/strings/get_html_translation_table_basic1.phpt
ext/standard/tests/strings/htmlentities-utf-3.phpt
ext/standard/tests/strings/md5_basic1.phpt
ext/standard/tests/strings/md5_basic2.phpt
ext/standard/tests/strings/md5_error.phpt
ext/standard/tests/strings/soundex_basic.phpt
ext/standard/tests/strings/soundex_error.phpt
ext/standard/tests/strings/str_rot13_basic.phpt
ext/standard/tests/strings/str_rot13_error.phpt
ext/standard/tests/strings/strnatcasecmp_error.phpt
ext/standard/tests/strings/strnatcmp_basic.phpt
ext/standard/tests/strings/strnatcmp_error.phpt
ext/xml/tests/bug49687.phpt
tests/basic/bug53180.phpt
tests/basic/req44164.phpt
tests/basic/rfc1867_max_file_uploads_empty_files.phpt
tests/lang/foreachLoop.001.phpt
tests/lang/foreachLoop.002.phpt
tests/lang/foreachLoop.003.phpt
tests/lang/foreachLoop.004.phpt
tests/lang/foreachLoop.005.phpt
tests/lang/foreachLoop.006.phpt
tests/lang/foreachLoop.009.phpt
tests/lang/foreachLoop.010.phpt
tests/lang/foreachLoop.011.phpt
tests/lang/foreachLoop.012.phpt
tests/lang/foreachLoop.013.phpt
tests/lang/foreachLoop.014.phpt
tests/lang/foreachLoop.015.phpt
tests/lang/foreachLoop.016.phpt
tests/lang/foreachLoop.017.phpt
tests/lang/operators/add_basiclong_64bit.phpt
tests/lang/operators/add_variationStr.phpt
tests/lang/operators/bitwiseAnd_variationStr.phpt
tests/lang/operators/bitwiseNot_variationStr.phpt
tests/lang/operators/bitwiseOr_variationStr.phpt
tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
tests/lang/operators/bitwiseXor_variationStr.phpt
tests/lang/operators/divide_basiclong_64bit.phpt
tests/lang/operators/divide_variationStr.phpt
tests/lang/operators/modulus_variationStr.phpt
tests/lang/operators/multiply_basiclong_64bit.phpt
tests/lang/operators/multiply_variationStr.phpt
tests/lang/operators/negate_basiclong_64bit.phpt
tests/lang/operators/negate_variationStr.phpt
tests/lang/operators/operator_equals_basic.phpt
tests/lang/operators/operator_equals_variation.phpt
tests/lang/operators/operator_equals_variation_64bit.phpt
tests/lang/operators/operator_gt_basic.phpt
tests/lang/operators/operator_gt_or_equal_basic.phpt
tests/lang/operators/operator_gt_or_equal_variation.phpt
tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt
tests/lang/operators/operator_gt_variation.phpt
tests/lang/operators/operator_gt_variation_64bit.phpt
tests/lang/operators/operator_identical_basic.phpt
tests/lang/operators/operator_identical_variation.phpt
tests/lang/operators/operator_identical_variation_64bit.phpt
tests/lang/operators/operator_lt_basic.phpt
tests/lang/operators/operator_lt_or_equal_basic.phpt
tests/lang/operators/operator_lt_or_equal_variation.phpt
tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt
tests/lang/operators/operator_lt_variation.phpt
tests/lang/operators/operator_lt_variation_64bit.phpt
tests/lang/operators/operator_notequals_basic.phpt
tests/lang/operators/operator_notequals_variation.phpt
tests/lang/operators/operator_notequals_variation_64bit.phpt
tests/lang/operators/operator_notidentical_basic.phpt
tests/lang/operators/operator_notidentical_variation.phpt
tests/lang/operators/operator_notidentical_variation_64bit.phpt
tests/lang/operators/operator_spaceship_basic.phpt
tests/lang/operators/postdec_basiclong_64bit.phpt
tests/lang/operators/postdec_variationStr.phpt
tests/lang/operators/postinc_basiclong_64bit.phpt
tests/lang/operators/postinc_variationStr.phpt
tests/lang/operators/predec_basiclong_64bit.phpt
tests/lang/operators/predec_variationStr.phpt
tests/lang/operators/preinc_basiclong_64bit.phpt
tests/lang/operators/subtract_basiclong_64bit.phpt
tests/lang/operators/subtract_variationStr.phpt
tests/lang/returnByReference.001.phpt
tests/lang/returnByReference.002.phpt
tests/lang/returnByReference.003.phpt
tests/lang/returnByReference.004.phpt
tests/lang/returnByReference.005.phpt
tests/lang/returnByReference.006.phpt
tests/lang/returnByReference.007.phpt
tests/lang/returnByReference.008.phpt
tests/lang/returnByReference.009.phpt
win32/build/buildconf.js
win32/syslog.reg

index 5268789df67cd7dffd192fbd50d272bae11b87f9..4fc329962006dfc45dac35c9c19ec18f0221d732 100644 (file)
@@ -1,71 +1,71 @@
---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
index 5bc8e5a6ab2a4b8c297183d571f99c2711632886..6122ccf2707176794bc9ec45348b11b8cfa8abc7 100644 (file)
@@ -1,30 +1,30 @@
---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)
index e67bb9b240531b6343afdcb870cda29269620d40..72b0db91a1a6c3d8ea741a674d903072d78968f7 100644 (file)
@@ -1,23 +1,23 @@
---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
index f3dc1d2918640d7acb96ee6b73b3306807b239f9..403d4e69c501c1e915e2e86d79b677becf6b875d 100644 (file)
@@ -1,22 +1,22 @@
---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===
index 2f5e4ee890958a266a6bd3f163f8d559cc4e509a..d3a9152905f0e7c0ea3eeea553ba738a45975ca9 100644 (file)
@@ -1,12 +1,12 @@
---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
index 13d4188f2f441e1664178eb024f7e850c9547a68..6a65ccff03cb8cf832a0c6cf4a03a7d06ea14c8b 100644 (file)
@@ -1,23 +1,23 @@
---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
index d86cb851b9d63247fbdc49b532ab9830129ff17a..5953c008d5889fcc7e18d2f87a08a5a678bc2e7f 100644 (file)
@@ -1,22 +1,22 @@
---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
index c076085519be133c377a3ea32e7f723b05665db6..64ebf6bf14d7f8e533a10919742508d7a9a3c137 100644 (file)
@@ -1,23 +1,23 @@
---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
index fbe5421c71c03d4d39fa27b10dc1275a87fe7348..01953cf7243d62ab80451952e6959a778fd1110c 100644 (file)
@@ -1,27 +1,27 @@
---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
index c360f457f0cbb82c79cca576432c3ce5546f9a87..3c3f3809088a156e311703b7f5f14443a5bf6b9a 100644 (file)
@@ -1,22 +1,22 @@
---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
index 878cf1fcc14d54560b32263fcba48b2939fc0ec5..9cda8aee1d138b7aa98a64986af80a39ee6dfb2d 100644 (file)
@@ -1,28 +1,28 @@
---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
index dc29ecefa24f45405e4a8846f352933405b1b624..bd7a60371240ac90ee3d30bcfc1c1a5dee0a4bc4 100644 (file)
@@ -1,24 +1,24 @@
---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
index 0fd8ff921b202c770b5dfc1d0e151ecbaec2b70b..590949c2f6bdac17ce9f8dec4cfcc4c1b7277f8c 100644 (file)
@@ -1,36 +1,36 @@
---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
index 327dd44a64d6b8ed77c3e07e48ce3653ef579aba..bbafbf210efc7bfb15fc63e09809dc600fb614c4 100644 (file)
@@ -1,27 +1,27 @@
---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
index a9b80c55be85a320a68976e6ce66fb2881fa293e..39f99a0fad4e68b7c75b4535ada7d442ce9645c8 100644 (file)
@@ -1,28 +1,28 @@
---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===
index 65f5e69acbc0b61e5f0bd5deb01f4aeec59206f3..7c0106cb6a4c02883ce8a8bfecf96c1452554875 100644 (file)
---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===
index 957a00194ad6188d49789414bb3f26f9be5691ca..9388679ebb4b122e739fa23c8ea0c14e3d2f162e 100644 (file)
@@ -1,36 +1,36 @@
---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)
index c87e6be1c72a46bfeb9816e66d32b2e7c13a290f..2adc6ed9772125fc0cddde8a6f055824620bf48e 100644 (file)
@@ -1,10 +1,10 @@
---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)
index bc0790ede4f3f1b38db5a0bee2dcd6d39b217336..9067500090c82d289afc1cd75033a5249f479328 100644 (file)
@@ -1,27 +1,27 @@
---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
index c84508509ceee36e0a156be40b21c7682b94131f..aeea7fb324f801fb080384d5c9afba0d8538269c 100644 (file)
@@ -1,51 +1,51 @@
---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===
index acf56e6b5b2b50fe7d28b5c67970df9a7e965272..d44a5274799487cf4877e751f2763f7d6191053a 100644 (file)
@@ -1,25 +1,25 @@
---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===
index 9e1fec8798fb47ac362248b2d1754fa975417420..ceb37c13c496bdeb8ad298cde3845809dd2b81b7 100644 (file)
@@ -1,60 +1,60 @@
---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: ++++
index f21de6ca3b83442bb2c13ea3859ce4f05e4a56ae..4cca9aec8e5b001c3ce4f122f3ac7f68bfb1aa27 100644 (file)
@@ -1,15 +1,15 @@
---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===
index 3bb710cdc7db8ccfacb14b2c49ffa8ae7132f14e..ccee8d6e67e1c7026ef49d6d8feebcb109f27b33 100644 (file)
@@ -1,24 +1,24 @@
---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===
index e6c670903966f724e21b62e90fbf007b0d2b4eff..aba91f0d3affe121077fe4509ca20d0b9dc063c1 100644 (file)
@@ -1,20 +1,20 @@
---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===
index 0cbbec34f2e5d0d0cedebf4b0c9bf86c1ac0ec08..810b15201fa563b240165206a0bff1ff54bf0a6a 100644 (file)
@@ -1,22 +1,22 @@
---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===
index fd17fe26ba9c2ab25d75aea4a0266b5655b41032..2211840f581b562017f3a5a37fd086dc48c9c627 100644 (file)
@@ -1,15 +1,15 @@
---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===
index 708fccd3d11ea065ea646bb2c8f3bda4c6ad6be4..1928ff696ac49fb4b901d3ca497d078d0d845c94 100644 (file)
-<?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);
+}
index 60291a69c01c5972a0f41c1e1e8ab7e4adfa2174..f37b3ca8e21cfc4a0631aaf6c19a92fdbf8f67db 100644 (file)
@@ -1,85 +1,85 @@
---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)
index 8a0f79d32457702ff4a66e3fbbe3ba1ba723d4c3..07f6b8ae4c1fefa3967db8ec86542fdb4835f211 100644 (file)
@@ -1,85 +1,85 @@
---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)
index 3fefb56bde1983b2845fe379d3b4c1a2498915d8..d02b97eec3649e6b7f314cf820317d1a0f96f581 100644 (file)
@@ -1,21 +1,21 @@
---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
index aeb7d82620c7f3d7b5da5957fe8c532b5c2ff439..f3313e11f425cced2127edd95a42a755a0a9e8e5 100644 (file)
@@ -1,26 +1,26 @@
---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
index a326e0a2ba48d881a25e9d7911d6fd7da11cc735..f4660940a2f875019508bd33185747f108d4bdcb 100644 (file)
@@ -1,30 +1,30 @@
---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
index 507d71532663c7090e220d05d54555449017c6db..d23cbdfe79ba94f547930988750aafaf883f34f8 100644 (file)
@@ -1,22 +1,22 @@
---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.
index 2b4235e85442c5b33d62142d844f7c385a6001ee..3b9e8d3f0ce31c826f357abb0954e3cf3c89e9ab 100644 (file)
@@ -1,19 +1,19 @@
---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
index 5fc1914ad03abc953614136f328ece02a471ae81..63525d2cb78a882996da2beb84ea011121c33ef5 100644 (file)
@@ -1,19 +1,19 @@
---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
index eceab1e99bade1445168dbed16a7f28751a924f4..350ee1bf826f588d90541b0b4ffa2a1cc362021d 100644 (file)
@@ -1,19 +1,19 @@
---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
index 5d8e1cecac3beebb229e7e1a225e12ac25ac56a0..4c448dc0272ebacc089c472a7ca14e969c617611 100644 (file)
@@ -1,19 +1,19 @@
---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
index df9c457d6f2e1a8f4982cb414a5c9491800c4843..fa9486e3de947b19363f697829284add2caf592f 100644 (file)
@@ -1,19 +1,19 @@
---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
index a91c6bbc0c79ba2045d73102bd64a45942a4a1d0..1523a9ec575e880022963707386282a4092120ba 100644 (file)
@@ -1,19 +1,19 @@
---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
index f819da6e6ca17038abb6c3ba9a2ce5ae71dda4ab..ee6326feffb2cf098c1ede31b7b61e5e44a570d6 100644 (file)
@@ -1,19 +1,19 @@
---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
index 361de69cde5bd95f4b08c80b2915d51c3c616b24..cb0746e4923f32dbed759453c06c1e0db506890b 100644 (file)
@@ -1,19 +1,19 @@
---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
index 130fa4320246cc71ec09ac8fecdd3ca093e8faba..0cfea7f415e35aa257b28b0300ada613f8442200 100644 (file)
@@ -1,42 +1,42 @@
---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');
+?>
index 55436741dbdbb1f9db7aef64e48e356095a4e066..593e43c8070d6db3ef2eab4694ce9c86ee1659e2 100644 (file)
@@ -1,38 +1,38 @@
---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)
index 324e229de5c4d649d63576df1d69815c1687b483..618fcdb0d47e6feb9c54ecd9d22b2f974398389c 100644 (file)
@@ -31,4 +31,4 @@ int(0)
 int(0)
 int(0)
 int(1)
-==DONE==\r
+==DONE==
index 2df112d7b23024d110a2e79e6f0964e404ca7186..3f1c2488b374e4a415da8888f69a59a938151d4a 100644 (file)
@@ -20,4 +20,4 @@ var_dump(abs($time * 1000 - $proc_now) < 2000);
 --EXPECT--
 bool(true)
 bool(true)
-==DONE==\r
+==DONE==
index 998e74bc01d7cbf2fbf81258ec5282236897d472..ac437f962b9df9a2f8dd6192d4c195cae7edd783 100644 (file)
@@ -23,4 +23,4 @@ bool(true)
 int(6)
 bool(true)
 int(5)
-==DONE==\r
+==DONE==
index 9365387ce6860e30e5ed50cb06b684da06fde1db..b2b08f362d41a7ae19fc48da39003aaaa6439f2f 100644 (file)
@@ -1,41 +1,41 @@
---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==
+
index d59c635a7dff1cd0c3df25d1f9ea902180f5f002..688ccc31bfcd8c6aa739ad9f91f81a2d2fbc3ff8 100644 (file)
@@ -1,10 +1,10 @@
---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");
@@ -27,8 +27,8 @@ echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\
 
 ?>
 ==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
index 2c9e1e33be659ce9e40b72d39f78827b0bbd4e60..a2cba4c76bc9119f238b141860cab50733ce5477 100644 (file)
@@ -1,34 +1,34 @@
---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==
+
index b4e59f5b7ee0451a612083bca5b9104e8aaa9360..567a7eb84972567f6be26209697376b19e389463 100644 (file)
@@ -1,10 +1,10 @@
---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");
@@ -22,8 +22,8 @@ echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
 
 ?>
 ==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
index 7aaf69e54e64440fd9272a1c4222cfb1930c88a5..221602d1359ebffd6b148b6879d925f58fb06395 100644 (file)
@@ -1,10 +1,10 @@
---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");
@@ -30,8 +30,8 @@ var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array()));
 
 ?>
 ==DONE==
-\r
---EXPECTF--\r
+
+--EXPECTF--
 
 Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
 bool(false)
@@ -71,4 +71,4 @@ bool(false)
 Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
 bool(false)
 ==DONE==
-\r
+
index 6a7eeae5eb13377eff9a284a3eb246f609ca8062..560dc8fb450d1e8519564122bcc02a2e6c6c6971 100644 (file)
@@ -1,33 +1,33 @@
-<?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
index 1988d3b9e54644fbd40e95800dea28b515a0905d..f8e3158cec8cfb2cd3432a642f25ad30009bd298 100644 (file)
@@ -28,4 +28,4 @@ IntlTimeZone Object
     [rawOffset] => %i
     [currentOffset] => %i
 )
-==DONE==\r
+==DONE==
index d600792d7cfc7d54c698eae85f4b4b483b835716..182fe15b608ae6d9028c6ba68434e1a49be13b53 100644 (file)
@@ -20,4 +20,4 @@ string(13) "Europe/Lisbon"
 bool(true)
 string(0) ""
 bool(false)
-==DONE==\r
+==DONE==
index 39e28892a448dbd3c8dbe76e0e660cfeac49790e..c8379d34a0384e87617497274794cf56f88eda68 100644 (file)
@@ -32,4 +32,4 @@ string(5) "+0000"
 string(3) "GMT"
 string(3) "GMT"
 string(13) "Portugal Time"
-==DONE==\r
+==DONE==
index fe96a56f0832b6909202b9df3f0b865a3e39cbc5..7dce14a7adff09fd05d578cd94f1cf2fc9fdff99 100644 (file)
@@ -1,23 +1,23 @@
---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 
index 81788d719656e45cf9e947d943b4123612983235..cb66d4e2301fd37caeeb2c0d5cba7104ccab3418 100644 (file)
@@ -1,13 +1,13 @@
---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"
+
index 25d5febe06ecaa791ff8b1e566aa0b9984fe475f..dcd6ee40e12060a10085d3f03d284db4d3fd0357 100644 (file)
@@ -1,58 +1,58 @@
---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
index 339fce7a8e6930601447bb210cc62a1d1f71170b..a34b7a3416d88fe3620a10ece414190130253fb6 100644 (file)
@@ -1,66 +1,66 @@
---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
index f9cd297eba32638351d1c322db8e5e3330e8c190..1caff1a27a802347a7721b7aa144d4d4b5d5f85a 100644 (file)
@@ -1,36 +1,36 @@
---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
index ba6e9902b3450a51feb09613fefc77ace8661798..04467bce24ebd3d3b4d6ff99ab8d0b1fcec94dd3 100644 (file)
@@ -1,20 +1,20 @@
---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!
index 31a7328b701e276c84fa2e6187d7b8ff553b5432..c8ad3c3675450c635a58c198e192b811a5af40d7 100644 (file)
@@ -1,40 +1,40 @@
---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
index 9fb0aa0f0302e05db2327309504f7e12c939472a..4d024755708349ca93339b357ddc9a9049b22448 100644 (file)
@@ -1,26 +1,26 @@
---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
index cf7ba5b72e72382cf7c65acec238311a73264065..09a00d896f6a78ec1fb30b0ce3b7e1563477ad8a 100644 (file)
@@ -1,42 +1,42 @@
---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"
index 707e10bce686f2fa9d4e5b6b3dc3399043abbc96..210e706bfbbe52fb86b2d4bd85700a6ec76e3d02 100644 (file)
@@ -1,27 +1,27 @@
---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===
index fb7e9a9d0a45be1a4045fdccb13dacef022a542a..4528213f11ee418750f91dd35b01195e721845e0 100644 (file)
@@ -1,33 +1,33 @@
---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!
index a88769b038196ec65150be5c90c7e0ebf58bedb3..1c8a1eed8f0a879c6f81f986cee0d76b9c515d4d 100755 (executable)
@@ -1,78 +1,78 @@
---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
index fd332fdf027c4886c8af5722e7a719d8186f4e88..2fc55d9155a95f3fa4bbd74b66c4afd01c4056c9 100644 (file)
@@ -1,28 +1,28 @@
---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
+
index 43c8c77823b7227e4b9e00ade4639f79d7713200..526a8cbf91538cab66cbfd04c3b17a773e601e2f 100644 (file)
@@ -1,48 +1,48 @@
---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===
index 5655d19972a2ed6b72326e2faf25bc67abb1d9d7..942bea2dc23529ed80c74a6abf7ec09cdf47da43 100644 (file)
@@ -1,76 +1,76 @@
---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.
index 657077093b7e2add1987cca4fa3e5dc02ce1d0d3..d8b4f0edc0c460c54416d049789e1efbc18650c1 100644 (file)
@@ -1,34 +1,34 @@
---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==
index 4ec9a49ca2959a944bc17a0c8e7e2db31641b978..b6a8babae8b88002640d1340f6c61d0047254ae6 100644 (file)
@@ -1,57 +1,57 @@
-@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
index 66a4ac1cbc3d23ec31fa21c53fa620bf132c863b..c1b64561745dc4e4fb745add000b949299765920 100644 (file)
@@ -1,42 +1,42 @@
---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>
index afccd6ce23dc5427392e5c948b48e86ebfbf39c9..b4d75cec488f02be613eb0ded5c1f67fd9768e94 100644 (file)
@@ -1,22 +1,22 @@
---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
index 8c90ae0b17621638070ab673ea812af0de5ea7ad..fc92563e84f9ae54310db1c5b51ac91bfa4143b3 100644 (file)
---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
index 61d1e8458f14b842e594c05859bf83374c79a152..6ff97b60d5145e239b3f032a900480aeebf77edc 100644 (file)
---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
index fda099877d6a98f6586fa68f9ae74d225d7a1c5b..9fd54599506938848cd17669f61dbf954a906271 100644 (file)
---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
index f75bb09903cf92abc7b763881fb11b7a8dfae967..a9d6293fc9df0b532b68760aa5f40d092271bf73 100644 (file)
@@ -1,70 +1,70 @@
---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)
index 4fd7e8da350346afb2635e1bd775134e869c2c0e..a6b128a222739db842e658d72dbbceb9e822680a 100644 (file)
@@ -1,19 +1,19 @@
---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');
@@ -24,6 +24,6 @@ var_dump(decoct($dirIterator->getInode()));
 --CLEAN--
 <?php
 rmdir('test_dir_ptfi');
-?>\r
---EXPECTF--\r
+?>
+--EXPECTF--
 string(%d) "%d"
index ba9014c690df7ab39d86d5f704bb04a52f935ee7..570bb21fda12bfa9960fd1d2d7cf6e8176711498 100644 (file)
@@ -1,25 +1,25 @@
---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:
index acfa6b99c5336571043dd204f04096a7dd94542c..79492e0e9c2b32583ee6c4733e3dad50bd18629e 100644 (file)
@@ -1,25 +1,25 @@
---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:
index 380b865cd2aac96e498535548008b2f0e1c0a9ee..9ee2c6ee5195e6af91ffb80f0d8fd2c6c34275b3 100644 (file)
@@ -1,19 +1,19 @@
---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');
@@ -25,6 +25,6 @@ var_dump($fileInfo->getInode() == $result);
 --CLEAN--
 <?php
 unlink('SplFileInfo_getInode_basic.txt');
-?>\r
---EXPECTF--\r
+?>
+--EXPECTF--
 bool(true)
index 31b53823365e5003a41edc908928e7f0f58e4f91..c2b980373548d6f38807f5471d8969a3d976fba2 100644 (file)
@@ -1,25 +1,25 @@
---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:
index f6b4b29195fb5792cee2c621c2a7d13fe2ac49bc..073744aa004e9111f332e98898382510e94fde10 100644 (file)
@@ -1,25 +1,25 @@
---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:
index 53591f34177593f5d8d545e0257463295249e330..af09907605504b72f93e8a3175d79c1542f14d48 100644 (file)
@@ -1,19 +1,19 @@
---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');
@@ -25,6 +25,6 @@ var_dump($fileInfo->getPerms() == 0100557);
 --CLEAN--
 <?php
 unlink('SplFileInfo_getPerms_basic.txt');
-?>\r
---EXPECTF--\r
+?>
+--EXPECTF--
 bool(true)
index 23b48de97672b393f3198e643f8b4bfa693e7b0a..4b70c2635b748699324eb9b3c7b9e11d36feef09 100644 (file)
@@ -1,25 +1,25 @@
---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:
index 5b6587c68522f679d93c5ccc62b9833cab7edd03..ee0b8a6fba745f1597812a706c536579137c804d 100644 (file)
@@ -1,20 +1,20 @@
---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===
index da63984d5c95eae1e7e41ee038898efec6ee3b76..c38464846648e9474dd3c3def5eaadac645d40bc 100644 (file)
@@ -1,62 +1,62 @@
---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
index e9b3177ed6f29035de6535522114d8caf83048a9..1ee44785b3ce09af32ff9c23d812aea70766198b 100644 (file)
@@ -1,17 +1,17 @@
---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
index c45f08ec45897b61eea3304da56f2b3b2a1ef2a3..bbb518e0741525562e73381d7b5c7a6f4659ef5b 100644 (file)
@@ -1,20 +1,20 @@
---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
index 21ec7980ad640418154f815627db72148714cb6f..8370906abb4f6445e5b012da2ca748b2e9ccf431 100644 (file)
@@ -1,32 +1,32 @@
---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
index c9e21b260e4bb64fe14c3d8188770c00ec282989..7ed3b6eb342e3d2acee51e33e18f8ac32e08c2b3 100644 (file)
@@ -1,36 +1,36 @@
---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
index cbf8136ab643e748577640d8a6108b18d3491cf5..0e3c1c1439b05d92cdc1513c74f41462dcfbf384 100644 (file)
@@ -1,36 +1,36 @@
---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
index 82d55cf0ce5a833667af209c45cc0cbe4c06bf34..32617bf1086eee8222a69c60d065b0574abf306d 100644 (file)
@@ -1,42 +1,42 @@
---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
index bb020fdff0dfbef387ccf0bb183da1505a64689b..a2c0d2ea1b84e225d5f6bda0adbb83184e245c54 100644 (file)
@@ -1,36 +1,36 @@
---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
index 7315751810c1ff8e3a1a22cd61f62b4424aaf9de..8634b67f7695c65bdb245ab532f9109886849575 100644 (file)
@@ -1,26 +1,26 @@
---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===
index 2faabb92c0329514b3ed91d50c1d5fe9d17ca6f3..76605d97a82cc313ef0010672056dd7126e3d021 100644 (file)
@@ -1,25 +1,25 @@
---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)
index 1ccc94e2875914b2d4503f6f57635626a2b5cf9f..d0805a16fdd07e82e518a086f76d43059d1a9f1b 100644 (file)
@@ -1,17 +1,17 @@
---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.
index 685bf146204d517c338679a47d205a8b4243d257..7ccf2be1099619bbe05ea4e668b2aa7d271df3c3 100644 (file)
@@ -1,23 +1,23 @@
---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.
index 1915b7f209761270fe33af57a1f9dc939a0ca741..7938196dbcd02bda527201a517d5853884a908d6 100644 (file)
@@ -1,18 +1,18 @@
---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
index 8915bb833c974cf742d1ed4021536f8c84187f8a..51dbac9c1e15d6674820568215f5a1bff31976c4 100644 (file)
@@ -1,74 +1,74 @@
---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.
index 1d25a12e049b067af2d09be2a76a753bca57fa7b..7be25949f60b1971ade54ad4c44c13941ab8d8fa 100644 (file)
@@ -1,70 +1,70 @@
---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
+
index 9520ecce74acef0f8e69a16b08c185b0795acd20..f487ed07442e32e94e1a9b9a7038161a54b16902 100644 (file)
@@ -1,20 +1,20 @@
---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--
index 5978e7f7f1c29ee9ef2014050363f69c23cb9d46..671c347a61dad2cd2e2dc4023882c8e2d2b996f5 100644 (file)
@@ -1,58 +1,58 @@
---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)
index a4277a47a1d146ec50d3a4a8d7a229c60e9ec78e..56764bcf5fe09db2bd4641661a091ae8842f2125 100644 (file)
@@ -1,59 +1,59 @@
---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)
index 509610f8a40aabc24628868b6a5e27a04c81b3d3..9f2ff850b616e189ec0bf25eb90aa6d7b20d50d3 100644 (file)
@@ -1,69 +1,69 @@
---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
+)
index 98e81787b80bb9b6e8d8a58d868c35722c747231..83bdea3a8c1dc626d49448bf3625f939349d04ca 100644 (file)
@@ -1,50 +1,50 @@
---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
+)
index 6d578386e6645a0dfd305322b3bc8db931391fd2..9be48c7eebcddb61971cf6e0398db3050beab8eb 100644 (file)
@@ -1,77 +1,77 @@
---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)
+
index 4d9f0dc5ee932983f357e988dd9ca1fec80d7061..54198a1337b7610a16fa0b8ced9c5af778ecdd25 100644 (file)
@@ -1,14 +1,14 @@
---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)
index 9e2e66c94c4bf122a7ee6cfa690c57950702ce51..544887129f47e1653700066491fffff409770cf6 100644 (file)
@@ -1,39 +1,39 @@
---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
index 4a8eceb24bc5371dcf70b53eafd89dcba87d31b7..52b2136f5b428d976e45c662809ecf403a496cb9 100644 (file)
@@ -1,23 +1,23 @@
---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
index 96084313c7ed1db7cd95abdbad858038d01c317c..8f7f22d7d3dea472bb8ca6c4842152dc0882b071 100644 (file)
@@ -1,46 +1,46 @@
---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
index 6b3bf6618c64784fc5078a107ffc57b6bb7f0fc9..79615f31b553887352ae6382bf4832178ce21698 100644 (file)
@@ -1,24 +1,24 @@
---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===
index 711490c41308372e8915a62e2cfc7a6280390b3e..2cb3d8d2293fff9c2a863a5c8d876a44e7765037 100644 (file)
@@ -1,18 +1,18 @@
---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
index 5ce7c4251aa93196c69804eb3b51051ea4d29410..9d1580c826124c853ec84f691f4c3c9bfd203351 100644 (file)
@@ -1,19 +1,19 @@
---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
index 4db4a5044f4e271db4ef1444880f9ea0b417fc02..594fcae4be57be74ad5a5fc90cc496ba7cc29fe1 100644 (file)
@@ -1,30 +1,30 @@
---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)
index 370dd13f1b52cbd94b559aefcae58dafb848604e..c0fc85c5ef0e3a56bca491cd47f65f2d2c13611d 100644 (file)
@@ -1,22 +1,22 @@
---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==
index 96d859992e8452b243b5b20402aa0abffecc9296..97a4481ea9fee5addabc0fbd0e2dd9f767557028 100644 (file)
@@ -1,12 +1,12 @@
---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.
index 38d904761d0b230c2f8641a409166efacde8b523..15b3cb07e9a78d77b15552cacebe11caade8a158 100644 (file)
@@ -1,40 +1,40 @@
---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("&#233;", ENT_QUOTES, "ISO-8859-1")));\r
-echo "double quotes variations:", "\n";\r
-echo html_entity_decode("&quot;", ENT_NOQUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode("&#34;", ENT_NOQUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode("&quot;", ENT_QUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode("&#34;", ENT_QUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode("&quot;", ENT_COMPAT, 'UTF-8'), "\n";\r
-echo html_entity_decode("&#34;", ENT_COMPAT, 'UTF-8'), "\n";\r
-echo html_entity_decode("&quot;"), "\n";\r
-echo html_entity_decode("&#34;"), "\n";\r
-\r
-echo "\nsingle quotes variations:", "\n";\r
-echo html_entity_decode("&#39;", ENT_NOQUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode("&#39;", ENT_QUOTES, 'UTF-8'), "\n";\r
-echo html_entity_decode("&#39;", ENT_COMPAT, 'UTF-8'), "\n";\r
-echo html_entity_decode("&#39;"), "\n";\r
---EXPECT--\r
-array(1) {\r
-  [1]=>\r
-  string(2) "e9"\r
-}\r
-double quotes variations:\r
-&quot;\r
-&#34;\r
-"\r
-"\r
-"\r
-"\r
-"\r
-"\r
-\r
-single quotes variations:\r
-&#39;\r
-'\r
-&#39;\r
-&#39;\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("&#233;", ENT_QUOTES, "ISO-8859-1")));
+echo "double quotes variations:", "\n";
+echo html_entity_decode("&quot;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;"), "\n";
+echo html_entity_decode("&#34;"), "\n";
+
+echo "\nsingle quotes variations:", "\n";
+echo html_entity_decode("&#39;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;"), "\n";
+--EXPECT--
+array(1) {
+  [1]=>
+  string(2) "e9"
+}
+double quotes variations:
+&quot;
+&#34;
+"
+"
+"
+"
+"
+"
+
+single quotes variations:
+&#39;
+'
+&#39;
+&#39;
index 87857d9cbdcd58aec17f58d3eeeac232f6eebab3..83892a381ae39d7d2220c94f7d7c2d709e3380f2 100644 (file)
---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) "&AElig;"\r
-  ["Á"]=>\r
-  string(8) "&Aacute;"\r
-  ["Â"]=>\r
-  string(7) "&Acirc;"\r
-  ["À"]=>\r
-  string(8) "&Agrave;"\r
-  ["Α"]=>\r
-  string(7) "&Alpha;"\r
-  ["Å"]=>\r
-  string(7) "&Aring;"\r
-  ["Ã"]=>\r
-  string(8) "&Atilde;"\r
-  ["Ä"]=>\r
-  string(6) "&Auml;"\r
-  ["Β"]=>\r
-  string(6) "&Beta;"\r
-  ["Ç"]=>\r
-  string(8) "&Ccedil;"\r
-  ["Χ"]=>\r
-  string(5) "&Chi;"\r
-  ["‡"]=>\r
-  string(8) "&Dagger;"\r
-  ["Δ"]=>\r
-  string(7) "&Delta;"\r
-  ["Ð"]=>\r
-  string(5) "&ETH;"\r
-  ["É"]=>\r
-  string(8) "&Eacute;"\r
-  ["Ê"]=>\r
-  string(7) "&Ecirc;"\r
-  ["È"]=>\r
-  string(8) "&Egrave;"\r
-  ["Ε"]=>\r
-  string(9) "&Epsilon;"\r
-  ["Η"]=>\r
-  string(5) "&Eta;"\r
-  ["Ë"]=>\r
-  string(6) "&Euml;"\r
-  ["Γ"]=>\r
-  string(7) "&Gamma;"\r
-  ["Í"]=>\r
-  string(8) "&Iacute;"\r
-  ["Î"]=>\r
-  string(7) "&Icirc;"\r
-  ["Ì"]=>\r
-  string(8) "&Igrave;"\r
-  ["Ι"]=>\r
-  string(6) "&Iota;"\r
-  ["Ï"]=>\r
-  string(6) "&Iuml;"\r
-  ["Κ"]=>\r
-  string(7) "&Kappa;"\r
-  ["Λ"]=>\r
-  string(8) "&Lambda;"\r
-  ["Μ"]=>\r
-  string(4) "&Mu;"\r
-  ["Ñ"]=>\r
-  string(8) "&Ntilde;"\r
-  ["Ν"]=>\r
-  string(4) "&Nu;"\r
-  ["Œ"]=>\r
-  string(7) "&OElig;"\r
-  ["Ó"]=>\r
-  string(8) "&Oacute;"\r
-  ["Ô"]=>\r
-  string(7) "&Ocirc;"\r
-  ["Ò"]=>\r
-  string(8) "&Ograve;"\r
-  ["Ω"]=>\r
-  string(7) "&Omega;"\r
-  ["Ο"]=>\r
-  string(9) "&Omicron;"\r
-  ["Ø"]=>\r
-  string(8) "&Oslash;"\r
-  ["Õ"]=>\r
-  string(8) "&Otilde;"\r
-  ["Ö"]=>\r
-  string(6) "&Ouml;"\r
-  ["Φ"]=>\r
-  string(5) "&Phi;"\r
-  ["Π"]=>\r
-  string(4) "&Pi;"\r
-  ["″"]=>\r
-  string(7) "&Prime;"\r
-  ["Ψ"]=>\r
-  string(5) "&Psi;"\r
-  ["Ρ"]=>\r
-  string(5) "&Rho;"\r
-  ["Š"]=>\r
-  string(8) "&Scaron;"\r
-  ["Σ"]=>\r
-  string(7) "&Sigma;"\r
-  ["Þ"]=>\r
-  string(7) "&THORN;"\r
-  ["Τ"]=>\r
-  string(5) "&Tau;"\r
-  ["Θ"]=>\r
-  string(7) "&Theta;"\r
-  ["Ú"]=>\r
-  string(8) "&Uacute;"\r
-  ["Û"]=>\r
-  string(7) "&Ucirc;"\r
-  ["Ù"]=>\r
-  string(8) "&Ugrave;"\r
-  ["Υ"]=>\r
-  string(9) "&Upsilon;"\r
-  ["Ü"]=>\r
-  string(6) "&Uuml;"\r
-  ["Ξ"]=>\r
-  string(4) "&Xi;"\r
-  ["Ý"]=>\r
-  string(8) "&Yacute;"\r
-  ["Ÿ"]=>\r
-  string(6) "&Yuml;"\r
-  ["Ζ"]=>\r
-  string(6) "&Zeta;"\r
-  ["á"]=>\r
-  string(8) "&aacute;"\r
-  ["â"]=>\r
-  string(7) "&acirc;"\r
-  ["´"]=>\r
-  string(7) "&acute;"\r
-  ["æ"]=>\r
-  string(7) "&aelig;"\r
-  ["à"]=>\r
-  string(8) "&agrave;"\r
-  ["ℵ"]=>\r
-  string(9) "&alefsym;"\r
-  ["α"]=>\r
-  string(7) "&alpha;"\r
-  ["&"]=>\r
-  string(5) "&amp;"\r
-  ["∧"]=>\r
-  string(5) "&and;"\r
-  ["∠"]=>\r
-  string(5) "&ang;"\r
-  ["å"]=>\r
-  string(7) "&aring;"\r
-  ["≈"]=>\r
-  string(7) "&asymp;"\r
-  ["ã"]=>\r
-  string(8) "&atilde;"\r
-  ["ä"]=>\r
-  string(6) "&auml;"\r
-  ["„"]=>\r
-  string(7) "&bdquo;"\r
-  ["β"]=>\r
-  string(6) "&beta;"\r
-  ["¦"]=>\r
-  string(8) "&brvbar;"\r
-  ["•"]=>\r
-  string(6) "&bull;"\r
-  ["∩"]=>\r
-  string(5) "&cap;"\r
-  ["ç"]=>\r
-  string(8) "&ccedil;"\r
-  ["¸"]=>\r
-  string(7) "&cedil;"\r
-  ["¢"]=>\r
-  string(6) "&cent;"\r
-  ["χ"]=>\r
-  string(5) "&chi;"\r
-  ["ˆ"]=>\r
-  string(6) "&circ;"\r
-  ["♣"]=>\r
-  string(7) "&clubs;"\r
-  ["≅"]=>\r
-  string(6) "&cong;"\r
-  ["©"]=>\r
-  string(6) "&copy;"\r
-  ["↵"]=>\r
-  string(7) "&crarr;"\r
-  ["∪"]=>\r
-  string(5) "&cup;"\r
-  ["¤"]=>\r
-  string(8) "&curren;"\r
-  ["⇓"]=>\r
-  string(6) "&dArr;"\r
-  ["†"]=>\r
-  string(8) "&dagger;"\r
-  ["↓"]=>\r
-  string(6) "&darr;"\r
-  ["°"]=>\r
-  string(5) "&deg;"\r
-  ["δ"]=>\r
-  string(7) "&delta;"\r
-  ["♦"]=>\r
-  string(7) "&diams;"\r
-  ["÷"]=>\r
-  string(8) "&divide;"\r
-  ["é"]=>\r
-  string(8) "&eacute;"\r
-  ["ê"]=>\r
-  string(7) "&ecirc;"\r
-  ["è"]=>\r
-  string(8) "&egrave;"\r
-  ["∅"]=>\r
-  string(7) "&empty;"\r
-  [" "]=>\r
-  string(6) "&emsp;"\r
-  [" "]=>\r
-  string(6) "&ensp;"\r
-  ["ε"]=>\r
-  string(9) "&epsilon;"\r
-  ["≡"]=>\r
-  string(7) "&equiv;"\r
-  ["η"]=>\r
-  string(5) "&eta;"\r
-  ["ð"]=>\r
-  string(5) "&eth;"\r
-  ["ë"]=>\r
-  string(6) "&euml;"\r
-  ["€"]=>\r
-  string(6) "&euro;"\r
-  ["∃"]=>\r
-  string(7) "&exist;"\r
-  ["ƒ"]=>\r
-  string(6) "&fnof;"\r
-  ["∀"]=>\r
-  string(8) "&forall;"\r
-  ["½"]=>\r
-  string(8) "&frac12;"\r
-  ["¼"]=>\r
-  string(8) "&frac14;"\r
-  ["¾"]=>\r
-  string(8) "&frac34;"\r
-  ["⁄"]=>\r
-  string(7) "&frasl;"\r
-  ["γ"]=>\r
-  string(7) "&gamma;"\r
-  ["≥"]=>\r
-  string(4) "&ge;"\r
-  [">"]=>\r
-  string(4) "&gt;"\r
-  ["⇔"]=>\r
-  string(6) "&hArr;"\r
-  ["↔"]=>\r
-  string(6) "&harr;"\r
-  ["♥"]=>\r
-  string(8) "&hearts;"\r
-  ["…"]=>\r
-  string(8) "&hellip;"\r
-  ["í"]=>\r
-  string(8) "&iacute;"\r
-  ["î"]=>\r
-  string(7) "&icirc;"\r
-  ["¡"]=>\r
-  string(7) "&iexcl;"\r
-  ["ì"]=>\r
-  string(8) "&igrave;"\r
-  ["ℑ"]=>\r
-  string(7) "&image;"\r
-  ["∞"]=>\r
-  string(7) "&infin;"\r
-  ["∫"]=>\r
-  string(5) "&int;"\r
-  ["ι"]=>\r
-  string(6) "&iota;"\r
-  ["¿"]=>\r
-  string(8) "&iquest;"\r
-  ["∈"]=>\r
-  string(6) "&isin;"\r
-  ["ï"]=>\r
-  string(6) "&iuml;"\r
-  ["κ"]=>\r
-  string(7) "&kappa;"\r
-  ["⇐"]=>\r
-  string(6) "&lArr;"\r
-  ["λ"]=>\r
-  string(8) "&lambda;"\r
-  ["〈"]=>\r
-  string(6) "&lang;"\r
-  ["«"]=>\r
-  string(7) "&laquo;"\r
-  ["←"]=>\r
-  string(6) "&larr;"\r
-  ["⌈"]=>\r
-  string(7) "&lceil;"\r
-  ["“"]=>\r
-  string(7) "&ldquo;"\r
-  ["≤"]=>\r
-  string(4) "&le;"\r
-  ["⌊"]=>\r
-  string(8) "&lfloor;"\r
-  ["∗"]=>\r
-  string(8) "&lowast;"\r
-  ["◊"]=>\r
-  string(5) "&loz;"\r
-  ["‎"]=>\r
-  string(5) "&lrm;"\r
-  ["‹"]=>\r
-  string(8) "&lsaquo;"\r
-  ["‘"]=>\r
-  string(7) "&lsquo;"\r
-  ["<"]=>\r
-  string(4) "&lt;"\r
-  ["¯"]=>\r
-  string(6) "&macr;"\r
-  ["—"]=>\r
-  string(7) "&mdash;"\r
-  ["µ"]=>\r
-  string(7) "&micro;"\r
-  ["·"]=>\r
-  string(8) "&middot;"\r
-  ["−"]=>\r
-  string(7) "&minus;"\r
-  ["μ"]=>\r
-  string(4) "&mu;"\r
-  ["∇"]=>\r
-  string(7) "&nabla;"\r
-  [" "]=>\r
-  string(6) "&nbsp;"\r
-  ["–"]=>\r
-  string(7) "&ndash;"\r
-  ["≠"]=>\r
-  string(4) "&ne;"\r
-  ["∋"]=>\r
-  string(4) "&ni;"\r
-  ["¬"]=>\r
-  string(5) "&not;"\r
-  ["∉"]=>\r
-  string(7) "&notin;"\r
-  ["⊄"]=>\r
-  string(6) "&nsub;"\r
-  ["ñ"]=>\r
-  string(8) "&ntilde;"\r
-  ["ν"]=>\r
-  string(4) "&nu;"\r
-  ["ó"]=>\r
-  string(8) "&oacute;"\r
-  ["ô"]=>\r
-  string(7) "&ocirc;"\r
-  ["œ"]=>\r
-  string(7) "&oelig;"\r
-  ["ò"]=>\r
-  string(8) "&ograve;"\r
-  ["‾"]=>\r
-  string(7) "&oline;"\r
-  ["ω"]=>\r
-  string(7) "&omega;"\r
-  ["ο"]=>\r
-  string(9) "&omicron;"\r
-  ["⊕"]=>\r
-  string(7) "&oplus;"\r
-  ["∨"]=>\r
-  string(4) "&or;"\r
-  ["ª"]=>\r
-  string(6) "&ordf;"\r
-  ["º"]=>\r
-  string(6) "&ordm;"\r
-  ["ø"]=>\r
-  string(8) "&oslash;"\r
-  ["õ"]=>\r
-  string(8) "&otilde;"\r
-  ["⊗"]=>\r
-  string(8) "&otimes;"\r
-  ["ö"]=>\r
-  string(6) "&ouml;"\r
-  ["¶"]=>\r
-  string(6) "&para;"\r
-  ["∂"]=>\r
-  string(6) "&part;"\r
-  ["‰"]=>\r
-  string(8) "&permil;"\r
-  ["⊥"]=>\r
-  string(6) "&perp;"\r
-  ["φ"]=>\r
-  string(5) "&phi;"\r
-  ["π"]=>\r
-  string(4) "&pi;"\r
-  ["ϖ"]=>\r
-  string(5) "&piv;"\r
-  ["±"]=>\r
-  string(8) "&plusmn;"\r
-  ["£"]=>\r
-  string(7) "&pound;"\r
-  ["′"]=>\r
-  string(7) "&prime;"\r
-  ["∏"]=>\r
-  string(6) "&prod;"\r
-  ["∝"]=>\r
-  string(6) "&prop;"\r
-  ["ψ"]=>\r
-  string(5) "&psi;"\r
-  ["""]=>\r
-  string(6) "&quot;"\r
-  ["⇒"]=>\r
-  string(6) "&rArr;"\r
-  ["√"]=>\r
-  string(7) "&radic;"\r
-  ["〉"]=>\r
-  string(6) "&rang;"\r
-  ["»"]=>\r
-  string(7) "&raquo;"\r
-  ["→"]=>\r
-  string(6) "&rarr;"\r
-  ["⌉"]=>\r
-  string(7) "&rceil;"\r
-  ["”"]=>\r
-  string(7) "&rdquo;"\r
-  ["ℜ"]=>\r
-  string(6) "&real;"\r
-  ["®"]=>\r
-  string(5) "&reg;"\r
-  ["⌋"]=>\r
-  string(8) "&rfloor;"\r
-  ["ρ"]=>\r
-  string(5) "&rho;"\r
-  ["‏"]=>\r
-  string(5) "&rlm;"\r
-  ["›"]=>\r
-  string(8) "&rsaquo;"\r
-  ["’"]=>\r
-  string(7) "&rsquo;"\r
-  ["‚"]=>\r
-  string(7) "&sbquo;"\r
-  ["š"]=>\r
-  string(8) "&scaron;"\r
-  ["⋅"]=>\r
-  string(6) "&sdot;"\r
-  ["§"]=>\r
-  string(6) "&sect;"\r
-  ["­"]=>\r
-  string(5) "&shy;"\r
-  ["σ"]=>\r
-  string(7) "&sigma;"\r
-  ["ς"]=>\r
-  string(8) "&sigmaf;"\r
-  ["∼"]=>\r
-  string(5) "&sim;"\r
-  ["♠"]=>\r
-  string(8) "&spades;"\r
-  ["⊂"]=>\r
-  string(5) "&sub;"\r
-  ["⊆"]=>\r
-  string(6) "&sube;"\r
-  ["∑"]=>\r
-  string(5) "&sum;"\r
-  ["¹"]=>\r
-  string(6) "&sup1;"\r
-  ["²"]=>\r
-  string(6) "&sup2;"\r
-  ["³"]=>\r
-  string(6) "&sup3;"\r
-  ["⊃"]=>\r
-  string(5) "&sup;"\r
-  ["⊇"]=>\r
-  string(6) "&supe;"\r
-  ["ß"]=>\r
-  string(7) "&szlig;"\r
-  ["τ"]=>\r
-  string(5) "&tau;"\r
-  ["∴"]=>\r
-  string(8) "&there4;"\r
-  ["θ"]=>\r
-  string(7) "&theta;"\r
-  ["ϑ"]=>\r
-  string(10) "&thetasym;"\r
-  [" "]=>\r
-  string(8) "&thinsp;"\r
-  ["þ"]=>\r
-  string(7) "&thorn;"\r
-  ["˜"]=>\r
-  string(7) "&tilde;"\r
-  ["×"]=>\r
-  string(7) "&times;"\r
-  ["™"]=>\r
-  string(7) "&trade;"\r
-  ["⇑"]=>\r
-  string(6) "&uArr;"\r
-  ["ú"]=>\r
-  string(8) "&uacute;"\r
-  ["↑"]=>\r
-  string(6) "&uarr;"\r
-  ["û"]=>\r
-  string(7) "&ucirc;"\r
-  ["ù"]=>\r
-  string(8) "&ugrave;"\r
-  ["¨"]=>\r
-  string(5) "&uml;"\r
-  ["ϒ"]=>\r
-  string(7) "&upsih;"\r
-  ["υ"]=>\r
-  string(9) "&upsilon;"\r
-  ["ü"]=>\r
-  string(6) "&uuml;"\r
-  ["℘"]=>\r
-  string(8) "&weierp;"\r
-  ["ξ"]=>\r
-  string(4) "&xi;"\r
-  ["ý"]=>\r
-  string(8) "&yacute;"\r
-  ["¥"]=>\r
-  string(5) "&yen;"\r
-  ["ÿ"]=>\r
-  string(6) "&yuml;"\r
-  ["ζ"]=>\r
-  string(6) "&zeta;"\r
-  ["‍"]=>\r
-  string(5) "&zwj;"\r
-  ["‌"]=>\r
-  string(6) "&zwnj;"\r
-}\r
--- with table = HTML_SPECIALCHARS --\r
-array(4) {\r
-  ["&"]=>\r
-  string(5) "&amp;"\r
-  [">"]=>\r
-  string(4) "&gt;"\r
-  ["<"]=>\r
-  string(4) "&lt;"\r
-  ["""]=>\r
-  string(6) "&quot;"\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) "&AElig;"
+  ["Á"]=>
+  string(8) "&Aacute;"
+  ["Â"]=>
+  string(7) "&Acirc;"
+  ["À"]=>
+  string(8) "&Agrave;"
+  ["Α"]=>
+  string(7) "&Alpha;"
+  ["Å"]=>
+  string(7) "&Aring;"
+  ["Ã"]=>
+  string(8) "&Atilde;"
+  ["Ä"]=>
+  string(6) "&Auml;"
+  ["Β"]=>
+  string(6) "&Beta;"
+  ["Ç"]=>
+  string(8) "&Ccedil;"
+  ["Χ"]=>
+  string(5) "&Chi;"
+  ["‡"]=>
+  string(8) "&Dagger;"
+  ["Δ"]=>
+  string(7) "&Delta;"
+  ["Ð"]=>
+  string(5) "&ETH;"
+  ["É"]=>
+  string(8) "&Eacute;"
+  ["Ê"]=>
+  string(7) "&Ecirc;"
+  ["È"]=>
+  string(8) "&Egrave;"
+  ["Ε"]=>
+  string(9) "&Epsilon;"
+  ["Η"]=>
+  string(5) "&Eta;"
+  ["Ë"]=>
+  string(6) "&Euml;"
+  ["Γ"]=>
+  string(7) "&Gamma;"
+  ["Í"]=>
+  string(8) "&Iacute;"
+  ["Î"]=>
+  string(7) "&Icirc;"
+  ["Ì"]=>
+  string(8) "&Igrave;"
+  ["Ι"]=>
+  string(6) "&Iota;"
+  ["Ï"]=>
+  string(6) "&Iuml;"
+  ["Κ"]=>
+  string(7) "&Kappa;"
+  ["Λ"]=>
+  string(8) "&Lambda;"
+  ["Μ"]=>
+  string(4) "&Mu;"
+  ["Ñ"]=>
+  string(8) "&Ntilde;"
+  ["Ν"]=>
+  string(4) "&Nu;"
+  ["Œ"]=>
+  string(7) "&OElig;"
+  ["Ó"]=>
+  string(8) "&Oacute;"
+  ["Ô"]=>
+  string(7) "&Ocirc;"
+  ["Ò"]=>
+  string(8) "&Ograve;"
+  ["Ω"]=>
+  string(7) "&Omega;"
+  ["Ο"]=>
+  string(9) "&Omicron;"
+  ["Ø"]=>
+  string(8) "&Oslash;"
+  ["Õ"]=>
+  string(8) "&Otilde;"
+  ["Ö"]=>
+  string(6) "&Ouml;"
+  ["Φ"]=>
+  string(5) "&Phi;"
+  ["Π"]=>
+  string(4) "&Pi;"
+  ["″"]=>
+  string(7) "&Prime;"
+  ["Ψ"]=>
+  string(5) "&Psi;"
+  ["Ρ"]=>
+  string(5) "&Rho;"
+  ["Š"]=>
+  string(8) "&Scaron;"
+  ["Σ"]=>
+  string(7) "&Sigma;"
+  ["Þ"]=>
+  string(7) "&THORN;"
+  ["Τ"]=>
+  string(5) "&Tau;"
+  ["Θ"]=>
+  string(7) "&Theta;"
+  ["Ú"]=>
+  string(8) "&Uacute;"
+  ["Û"]=>
+  string(7) "&Ucirc;"
+  ["Ù"]=>
+  string(8) "&Ugrave;"
+  ["Υ"]=>
+  string(9) "&Upsilon;"
+  ["Ü"]=>
+  string(6) "&Uuml;"
+  ["Ξ"]=>
+  string(4) "&Xi;"
+  ["Ý"]=>
+  string(8) "&Yacute;"
+  ["Ÿ"]=>
+  string(6) "&Yuml;"
+  ["Ζ"]=>
+  string(6) "&Zeta;"
+  ["á"]=>
+  string(8) "&aacute;"
+  ["â"]=>
+  string(7) "&acirc;"
+  ["´"]=>
+  string(7) "&acute;"
+  ["æ"]=>
+  string(7) "&aelig;"
+  ["à"]=>
+  string(8) "&agrave;"
+  ["ℵ"]=>
+  string(9) "&alefsym;"
+  ["α"]=>
+  string(7) "&alpha;"
+  ["&"]=>
+  string(5) "&amp;"
+  ["∧"]=>
+  string(5) "&and;"
+  ["∠"]=>
+  string(5) "&ang;"
+  ["å"]=>
+  string(7) "&aring;"
+  ["≈"]=>
+  string(7) "&asymp;"
+  ["ã"]=>
+  string(8) "&atilde;"
+  ["ä"]=>
+  string(6) "&auml;"
+  ["„"]=>
+  string(7) "&bdquo;"
+  ["β"]=>
+  string(6) "&beta;"
+  ["¦"]=>
+  string(8) "&brvbar;"
+  ["•"]=>
+  string(6) "&bull;"
+  ["∩"]=>
+  string(5) "&cap;"
+  ["ç"]=>
+  string(8) "&ccedil;"
+  ["¸"]=>
+  string(7) "&cedil;"
+  ["¢"]=>
+  string(6) "&cent;"
+  ["χ"]=>
+  string(5) "&chi;"
+  ["ˆ"]=>
+  string(6) "&circ;"
+  ["♣"]=>
+  string(7) "&clubs;"
+  ["≅"]=>
+  string(6) "&cong;"
+  ["©"]=>
+  string(6) "&copy;"
+  ["↵"]=>
+  string(7) "&crarr;"
+  ["∪"]=>
+  string(5) "&cup;"
+  ["¤"]=>
+  string(8) "&curren;"
+  ["⇓"]=>
+  string(6) "&dArr;"
+  ["†"]=>
+  string(8) "&dagger;"
+  ["↓"]=>
+  string(6) "&darr;"
+  ["°"]=>
+  string(5) "&deg;"
+  ["δ"]=>
+  string(7) "&delta;"
+  ["♦"]=>
+  string(7) "&diams;"
+  ["÷"]=>
+  string(8) "&divide;"
+  ["é"]=>
+  string(8) "&eacute;"
+  ["ê"]=>
+  string(7) "&ecirc;"
+  ["è"]=>
+  string(8) "&egrave;"
+  ["∅"]=>
+  string(7) "&empty;"
+  [" "]=>
+  string(6) "&emsp;"
+  [" "]=>
+  string(6) "&ensp;"
+  ["ε"]=>
+  string(9) "&epsilon;"
+  ["≡"]=>
+  string(7) "&equiv;"
+  ["η"]=>
+  string(5) "&eta;"
+  ["ð"]=>
+  string(5) "&eth;"
+  ["ë"]=>
+  string(6) "&euml;"
+  ["€"]=>
+  string(6) "&euro;"
+  ["∃"]=>
+  string(7) "&exist;"
+  ["ƒ"]=>
+  string(6) "&fnof;"
+  ["∀"]=>
+  string(8) "&forall;"
+  ["½"]=>
+  string(8) "&frac12;"
+  ["¼"]=>
+  string(8) "&frac14;"
+  ["¾"]=>
+  string(8) "&frac34;"
+  ["⁄"]=>
+  string(7) "&frasl;"
+  ["γ"]=>
+  string(7) "&gamma;"
+  ["≥"]=>
+  string(4) "&ge;"
+  [">"]=>
+  string(4) "&gt;"
+  ["⇔"]=>
+  string(6) "&hArr;"
+  ["↔"]=>
+  string(6) "&harr;"
+  ["♥"]=>
+  string(8) "&hearts;"
+  ["…"]=>
+  string(8) "&hellip;"
+  ["í"]=>
+  string(8) "&iacute;"
+  ["î"]=>
+  string(7) "&icirc;"
+  ["¡"]=>
+  string(7) "&iexcl;"
+  ["ì"]=>
+  string(8) "&igrave;"
+  ["ℑ"]=>
+  string(7) "&image;"
+  ["∞"]=>
+  string(7) "&infin;"
+  ["∫"]=>
+  string(5) "&int;"
+  ["ι"]=>
+  string(6) "&iota;"
+  ["¿"]=>
+  string(8) "&iquest;"
+  ["∈"]=>
+  string(6) "&isin;"
+  ["ï"]=>
+  string(6) "&iuml;"
+  ["κ"]=>
+  string(7) "&kappa;"
+  ["⇐"]=>
+  string(6) "&lArr;"
+  ["λ"]=>
+  string(8) "&lambda;"
+  ["〈"]=>
+  string(6) "&lang;"
+  ["«"]=>
+  string(7) "&laquo;"
+  ["←"]=>
+  string(6) "&larr;"
+  ["⌈"]=>
+  string(7) "&lceil;"
+  ["“"]=>
+  string(7) "&ldquo;"
+  ["≤"]=>
+  string(4) "&le;"
+  ["⌊"]=>
+  string(8) "&lfloor;"
+  ["∗"]=>
+  string(8) "&lowast;"
+  ["◊"]=>
+  string(5) "&loz;"
+  ["‎"]=>
+  string(5) "&lrm;"
+  ["‹"]=>
+  string(8) "&lsaquo;"
+  ["‘"]=>
+  string(7) "&lsquo;"
+  ["<"]=>
+  string(4) "&lt;"
+  ["¯"]=>
+  string(6) "&macr;"
+  ["—"]=>
+  string(7) "&mdash;"
+  ["µ"]=>
+  string(7) "&micro;"
+  ["·"]=>
+  string(8) "&middot;"
+  ["−"]=>
+  string(7) "&minus;"
+  ["μ"]=>
+  string(4) "&mu;"
+  ["∇"]=>
+  string(7) "&nabla;"
+  [" "]=>
+  string(6) "&nbsp;"
+  ["–"]=>
+  string(7) "&ndash;"
+  ["≠"]=>
+  string(4) "&ne;"
+  ["∋"]=>
+  string(4) "&ni;"
+  ["¬"]=>
+  string(5) "&not;"
+  ["∉"]=>
+  string(7) "&notin;"
+  ["⊄"]=>
+  string(6) "&nsub;"
+  ["ñ"]=>
+  string(8) "&ntilde;"
+  ["ν"]=>
+  string(4) "&nu;"
+  ["ó"]=>
+  string(8) "&oacute;"
+  ["ô"]=>
+  string(7) "&ocirc;"
+  ["œ"]=>
+  string(7) "&oelig;"
+  ["ò"]=>
+  string(8) "&ograve;"
+  ["‾"]=>
+  string(7) "&oline;"
+  ["ω"]=>
+  string(7) "&omega;"
+  ["ο"]=>
+  string(9) "&omicron;"
+  ["⊕"]=>
+  string(7) "&oplus;"
+  ["∨"]=>
+  string(4) "&or;"
+  ["ª"]=>
+  string(6) "&ordf;"
+  ["º"]=>
+  string(6) "&ordm;"
+  ["ø"]=>
+  string(8) "&oslash;"
+  ["õ"]=>
+  string(8) "&otilde;"
+  ["⊗"]=>
+  string(8) "&otimes;"
+  ["ö"]=>
+  string(6) "&ouml;"
+  ["¶"]=>
+  string(6) "&para;"
+  ["∂"]=>
+  string(6) "&part;"
+  ["‰"]=>
+  string(8) "&permil;"
+  ["⊥"]=>
+  string(6) "&perp;"
+  ["φ"]=>
+  string(5) "&phi;"
+  ["π"]=>
+  string(4) "&pi;"
+  ["ϖ"]=>
+  string(5) "&piv;"
+  ["±"]=>
+  string(8) "&plusmn;"
+  ["£"]=>
+  string(7) "&pound;"
+  ["′"]=>
+  string(7) "&prime;"
+  ["∏"]=>
+  string(6) "&prod;"
+  ["∝"]=>
+  string(6) "&prop;"
+  ["ψ"]=>
+  string(5) "&psi;"
+  ["""]=>
+  string(6) "&quot;"
+  ["⇒"]=>
+  string(6) "&rArr;"
+  ["√"]=>
+  string(7) "&radic;"
+  ["〉"]=>
+  string(6) "&rang;"
+  ["»"]=>
+  string(7) "&raquo;"
+  ["→"]=>
+  string(6) "&rarr;"
+  ["⌉"]=>
+  string(7) "&rceil;"
+  ["”"]=>
+  string(7) "&rdquo;"
+  ["ℜ"]=>
+  string(6) "&real;"
+  ["®"]=>
+  string(5) "&reg;"
+  ["⌋"]=>
+  string(8) "&rfloor;"
+  ["ρ"]=>
+  string(5) "&rho;"
+  ["‏"]=>
+  string(5) "&rlm;"
+  ["›"]=>
+  string(8) "&rsaquo;"
+  ["’"]=>
+  string(7) "&rsquo;"
+  ["‚"]=>
+  string(7) "&sbquo;"
+  ["š"]=>
+  string(8) "&scaron;"
+  ["⋅"]=>
+  string(6) "&sdot;"
+  ["§"]=>
+  string(6) "&sect;"
+  ["­"]=>
+  string(5) "&shy;"
+  ["σ"]=>
+  string(7) "&sigma;"
+  ["ς"]=>
+  string(8) "&sigmaf;"
+  ["∼"]=>
+  string(5) "&sim;"
+  ["♠"]=>
+  string(8) "&spades;"
+  ["⊂"]=>
+  string(5) "&sub;"
+  ["⊆"]=>
+  string(6) "&sube;"
+  ["∑"]=>
+  string(5) "&sum;"
+  ["¹"]=>
+  string(6) "&sup1;"
+  ["²"]=>
+  string(6) "&sup2;"
+  ["³"]=>
+  string(6) "&sup3;"
+  ["⊃"]=>
+  string(5) "&sup;"
+  ["⊇"]=>
+  string(6) "&supe;"
+  ["ß"]=>
+  string(7) "&szlig;"
+  ["τ"]=>
+  string(5) "&tau;"
+  ["∴"]=>
+  string(8) "&there4;"
+  ["θ"]=>
+  string(7) "&theta;"
+  ["ϑ"]=>
+  string(10) "&thetasym;"
+  [" "]=>
+  string(8) "&thinsp;"
+  ["þ"]=>
+  string(7) "&thorn;"
+  ["˜"]=>
+  string(7) "&tilde;"
+  ["×"]=>
+  string(7) "&times;"
+  ["™"]=>
+  string(7) "&trade;"
+  ["⇑"]=>
+  string(6) "&uArr;"
+  ["ú"]=>
+  string(8) "&uacute;"
+  ["↑"]=>
+  string(6) "&uarr;"
+  ["û"]=>
+  string(7) "&ucirc;"
+  ["ù"]=>
+  string(8) "&ugrave;"
+  ["¨"]=>
+  string(5) "&uml;"
+  ["ϒ"]=>
+  string(7) "&upsih;"
+  ["υ"]=>
+  string(9) "&upsilon;"
+  ["ü"]=>
+  string(6) "&uuml;"
+  ["℘"]=>
+  string(8) "&weierp;"
+  ["ξ"]=>
+  string(4) "&xi;"
+  ["ý"]=>
+  string(8) "&yacute;"
+  ["¥"]=>
+  string(5) "&yen;"
+  ["ÿ"]=>
+  string(6) "&yuml;"
+  ["ζ"]=>
+  string(6) "&zeta;"
+  ["‍"]=>
+  string(5) "&zwj;"
+  ["‌"]=>
+  string(6) "&zwnj;"
+}
+-- with table = HTML_SPECIALCHARS --
+array(4) {
+  ["&"]=>
+  string(5) "&amp;"
+  [">"]=>
+  string(4) "&gt;"
+  ["<"]=>
+  string(4) "&lt;"
+  ["""]=>
+  string(6) "&quot;"
+}
+Done
index c28917ba16cf2165a02a05673406dc2979416ec1..82693056ef06b5553b22bd16cb1a97b783428d49 100644 (file)
@@ -1,83 +1,83 @@
---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.
index eda414bc2526d4b2224c0d79885346d49e9b08ba..a2b23485887822029a312c10f35c4b03b2e05134 100644 (file)
@@ -1,17 +1,17 @@
---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===
index 1f89ba82f511269c993c494cbb693df02e7a665b..51f711d6c7b69812db82c81f8aab72aefb5bac0c 100644 (file)
@@ -1,30 +1,30 @@
---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
index 190b09c8e5d9577837f647962d67de18d647ab14..dbdbdcb2a541390bf63fc8d9219c3c8e19d23341 100644 (file)
@@ -1,35 +1,35 @@
---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
index 65bcb6425237ce75691a1a17b406e5fddb1f71c2..9777473ee994b15aad5d05831002ad7e877a4d34 100644 (file)
@@ -1,46 +1,46 @@
---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===
index a81b9d24fed97d63f64c93bd53025c2a56f59a5f..20cf2c9d3e492efc85249dffdcc9c5f827821d03 100644 (file)
@@ -1,34 +1,34 @@
---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
index 949d725754e912fdf8a3399ed32ca0ecb58da691..321a2bf1b769088d9a65d9763167a9d79959af24 100644 (file)
@@ -1,55 +1,55 @@
---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
index 99a99f29c5e0f6c779924b6a66d34ff9758e20c1..2361c0abb5ac758fce26e4863ba4fc5b4de790b0 100644 (file)
@@ -1,32 +1,32 @@
---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
index 45a15daefc717e5c2e6923f1fe71b7b0c4dc39c6..3085e8d8fd6294bf7d0d9b741f60a2b9f1920956 100644 (file)
@@ -1,33 +1,33 @@
---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
index 140bd48d6c5e92f3eefbb3c22a59fcba614a95e5..bef01de6535440a6c029fd354a42dcb7ccda5039 100644 (file)
@@ -1,80 +1,80 @@
---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
index 09cc668af9341ae6922e80ce5117c96fe312f71b..2b6d93afee916a05574e8a2b1e0e59fb7c2fa8dd 100644 (file)
@@ -1,34 +1,34 @@
---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===
index 3ff19cee7e0a2f878bb303111aa3ed83095008a4..6101f9f354ab34281e6888162530737ef496dcd9 100644 (file)
@@ -1,24 +1,24 @@
---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.
index 5c2eb76952fcbc2fd0953b9ec372eb895ffc2cd7..16783de8a7be3ee05f0bd37af37b71c26081f2da 100644 (file)
@@ -1,19 +1,19 @@
---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"
+}
index d0082861f2f9a0186683a72bada5a3cb227cb3f0..7a142f5fb972e858bb49544c896662f50149a05a 100644 (file)
@@ -1,17 +1,17 @@
---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
index 4da55f2597bfbba1d6424368c809427183593ee3..6ea7915c250cf4e1f178ef6b3c67ab89faa6edd1 100644 (file)
@@ -1,98 +1,98 @@
---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) ""
index d35f26116dcdc85e3fc0b5457e04243bcf598650..a7ec701fd1406508ee90be4997e93fdea1bec94c 100644 (file)
@@ -1,64 +1,64 @@
---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"
index 5896124f40a749287aed068f7c219ed859a88b84..31492953a466efe7b33771df53f4031b9d8faa26 100644 (file)
---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"
 }
index d554d0d87f2b5c60a1bdcfb08f7ba767685cf9db..a62d5dbb3b2fa3516098864e9422094775794f9c 100644 (file)
@@ -1,46 +1,46 @@
---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.
index 178cad098111750d27a96e2b120180beabd8fddf..3cc1960ca141e15578e8ecacf994aefde5c27584 100644 (file)
@@ -1,76 +1,76 @@
---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"
 }
index ae6ed3aa28ff6d4e9b409f1e61942f3e4938f975..c7e4ceb8e771b5122b34f6836a8d68dccff8b04b 100644 (file)
@@ -1,23 +1,23 @@
---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
index d31ea64563e22ad0208813d82a5665adb54c55d1..f7563dccd05e9e556f9a612b4cfc0078888cb59a 100644 (file)
@@ -1,11 +1,11 @@
---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
index df51fd6be4f9552c7434c43cbe08e54adbe76df8..90aa33953ba9c2a7631656c17f517ec023ff19b3 100644 (file)
@@ -1,78 +1,78 @@
---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.
+
index 31f6e8cc49f8f2e2e0376a7a86fee084d5c0beb9..c021a80c39595113e93112cf0098f4070e18ad35 100644 (file)
@@ -1,40 +1,40 @@
---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)
index 8527a8833e4a767089e7308f71c2abba886202d9..6ceebd8a50fb9a91c2c10d856d976d1a2ed58ab2 100644 (file)
@@ -1,33 +1,33 @@
---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)
index 1165b74a58753133a55233ceca405c4d561d06e0..3652a71aed6263e5adac52a82f6e539e1937cfe4 100644 (file)
---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"
+}
index ea728156f0f4ee2862314d41f487de6531e6687d..ba1bc89628da6204f766a5d4815ebe91d9e0b57d 100644 (file)
---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"
+}
index 9b179ab22a7f9e0c6c4b50fc60d7e779bf4f4654..770ee9f92e0136993a50628bf89966ecf89e4435 100644 (file)
---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"
+}
index a4ee09d6a96900458349706675ff26284ce3d473..f7f5389395725a0b705697d90cc4765ae7e1a8ec 100644 (file)
---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"
+}
index d570aba3167133e64084851144d5d88ef77599b3..91c96f694d7a2bc1865c0732847abbfe84709c89 100644 (file)
---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"
+}
index 4c3a1f6c3e9829df5b2507185aa1099415175bf7..987fe3cb27fca24fe324f11bbb54bf6ff3626f5e 100644 (file)
@@ -1,11 +1,11 @@
---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
index cae8f4f1fb59916da6cba103580391041534db34..eb55d5f21012be404a07338351df422418de07d5 100644 (file)
@@ -1,44 +1,44 @@
---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 ---
@@ -578,5 +578,5 @@ float(1.844674407371E+19)
 --- testing: 9223372036854775807 + -9223372036854775807 ---
 int(0)
 --- testing: 9223372036854775807 + -9.2233720368548E+18 ---
-float(0)\r
-===DONE===\r
+float(0)
+===DONE===
index 264c5c1bb968a768b23d3e3cf52707e0d10ab486..9bf11ec6981f78ab1cc5d167146cff72e963a50d 100644 (file)
@@ -1,26 +1,26 @@
---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' ---
@@ -412,5 +412,5 @@ int(123)
 --- testing: 'a5.9' + '3.4a' ---
 float(3.4)
 --- testing: 'a5.9' + 'a5.9' ---
-int(0)\r
-===DONE===\r
+int(0)
+===DONE===
index 26022705fcb1849f53cc2886daa0b46b863f19e9..5b7cb10b12371e96448108960bf1c09f28e9ea4a 100644 (file)
@@ -1,26 +1,26 @@
---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' ---
@@ -412,5 +412,5 @@ string(8) "21302221"
 --- testing: 'a5.9' & '3.4a' ---
 string(8) "21242421"
 --- testing: 'a5.9' & 'a5.9' ---
-string(8) "61352e39"\r
-===DONE===\r
+string(8) "61352e39"
+===DONE===
index 3e7b698680d5b6da12c8a44f45d090ef795a9f2a..98bca9e473720d90fc7e189158edd2286030f2cc 100644 (file)
@@ -1,22 +1,22 @@
---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' ---
@@ -44,5 +44,5 @@ string(14) "cecdcc9e9d9cdf"
 --- testing: '3.4a' ---
 string(8) "ccd1cb9e"
 --- testing: 'a5.9' ---
-string(8) "9ecad1c6"\r
-===DONE===\r
+string(8) "9ecad1c6"
+===DONE===
index 6c31477884ee7dcba45aab819e68e7074511c7f4..2d1d3537888ba901e7e87eb4f79cf393dc1d5eac 100644 (file)
@@ -1,26 +1,26 @@
---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' ---
@@ -412,5 +412,5 @@ string(14) "71373f79626320"
 --- testing: 'a5.9' | '3.4a' ---
 string(8) "733f3e79"
 --- testing: 'a5.9' | 'a5.9' ---
-string(8) "61352e39"\r
-===DONE===\r
+string(8) "61352e39"
+===DONE===
index 69fd90f1c8cd652ec36cc828549a0901e8bfb18a..ddfd2f7c6d07153afeb0ff97ebed081b385ca45a 100644 (file)
---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===
index 7dda65910a1432103b58f43ae72915b4eb090048..64d5eb75d8027766037f5a54281b80e68d93b12b 100644 (file)
@@ -1,26 +1,26 @@
---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' ---
@@ -412,5 +412,5 @@ string(8) "50071d58"
 --- testing: 'a5.9' ^ '3.4a' ---
 string(8) "521b1a58"
 --- testing: 'a5.9' ^ 'a5.9' ---
-string(8) "00000000"\r
-===DONE===\r
+string(8) "00000000"
+===DONE===
index c6bed0c88bc933d6bc79d74f3d401f0b64e0dc38..0dd08f534f6b59b8529b1aefc31f1e7a704e520b 100644 (file)
@@ -1,44 +1,44 @@
---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 ---
@@ -578,5 +578,5 @@ float(1)
 --- testing: 9223372036854775807 / -9223372036854775807 ---
 int(-1)
 --- testing: 9223372036854775807 / -9.2233720368548E+18 ---
-float(-1)\r
-===DONE===\r
+float(-1)
+===DONE===
index f54013fcece239d25786887eb111bbbdeb8bc728..88ff8f18406f78896ad0ccb6c7e467636defac7f 100644 (file)
@@ -1,26 +1,26 @@
---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' ---
@@ -412,5 +412,5 @@ int(0)
 --- testing: 'a5.9' / '3.4a' ---
 float(0)
 --- testing: 'a5.9' / 'a5.9' ---
-float(NAN)\r
-===DONE===\r
+float(NAN)
+===DONE===
index 4cfd7768ffe2e6b75ef1d3ebcd5013d65c1daa0e..6441428e3e5f3e211c1eda70731e5ab3e227a5bc 100644 (file)
---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===
index 4c7077bf3b95f79e833b12fe2ece78e013b51537..31d9188a775a160c2285f58de51734701083b6c7 100644 (file)
@@ -1,44 +1,44 @@
---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 ---
@@ -578,5 +578,5 @@ float(8.5070591730235E+37)
 --- testing: 9223372036854775807 * -9223372036854775807 ---
 float(-8.5070591730235E+37)
 --- testing: 9223372036854775807 * -9.2233720368548E+18 ---
-float(-8.5070591730235E+37)\r
-===DONE===\r
+float(-8.5070591730235E+37)
+===DONE===
index 30d5f79f1a3f00a5c05c040287eda51101acef61..01d7e050749a1f94610098ce79b1ebefec2131a8 100644 (file)
@@ -1,26 +1,26 @@
---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' ---
@@ -412,5 +412,5 @@ int(0)
 --- testing: 'a5.9' * '3.4a' ---
 float(0)
 --- testing: 'a5.9' * 'a5.9' ---
-int(0)\r
-===DONE===\r
+int(0)
+===DONE===
index e0cf10da69dd6ddb1d05741d40cbb28376ce87c2..47b25e5397b4cc97bf29c8fbddc3257dd38b23ae 100644 (file)
@@ -1,32 +1,32 @@
---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 ---
@@ -56,5 +56,5 @@ float(-9.2233720368548E+18)
 --- testing: -9223372036854775807 ---
 int(9223372036854775807)
 --- testing: -9.2233720368548E+18 ---
-float(9.2233720368548E+18)\r
-===DONE===\r
+float(9.2233720368548E+18)
+===DONE===
index 7405d42882e93964a2152ca1945f9a220e16825a..ccff2fba2c2e6ee227015302b33f0e10440056c2 100644 (file)
@@ -1,22 +1,22 @@
---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' ---
@@ -60,5 +60,5 @@ float(-3.4)
 --- testing: 'a5.9' ---
 
 Warning: A non-numeric value encountered in %s on line %d
-int(0)\r
-===DONE===\r
+int(0)
+===DONE===
index 3cb2704444e75c739fbb4dcb755f27e22a70f42f..9de4ed1a2aa8fbc919828a27e6c4c3098d1a4244 100644 (file)
@@ -1,65 +1,65 @@
---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===
index f7dc32868cff7ec89b9f0e9eb35dbcb333f512d9..d72253404b6295b03ae6fc0ec155a5f6f8f5111e 100644 (file)
@@ -1,63 +1,63 @@
---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===
index 6329225fcc4912242c80f3fa059f97f9b1b4d2bc..ada6c2d7ecc27607f7151f21def6c29b5a484b55 100644 (file)
@@ -1,65 +1,65 @@
---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===
index c410b19dc86ea74bc4221a4ae3d959ea3faad627..db856c62e651b5995b14996a1bc64b770aed1296 100644 (file)
@@ -1,65 +1,65 @@
---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===
index 20b00df8bbcc71cf98e347f007d0f70a2f50d69f..f1b1e01048b7d1772e74abcc812fb10867a4f4ed 100644 (file)
@@ -1,65 +1,65 @@
---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===
index 6cb6ed6d81ccd1e84fccd0e079e0a84f3cd618b7..2355ab4c45a1b6915295d03295d734fb63abea55 100644 (file)
@@ -1,63 +1,63 @@
---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===
index 52ef7100a60ee6c81b30de90ebc254591500e2c3..8a1ed35f10976d1803e6194cecd0404aa7039abc 100644 (file)
@@ -1,63 +1,63 @@
---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===
index 1b429a076f348d22d51b6fa58ffa3f928a0d32af..ff15550dbe2a5ea6d201df5d83cc2134e62c3750 100644 (file)
@@ -1,62 +1,62 @@
---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===
index 1881567080ae344af70045c5f03ec21e8af5375e..15c6b88319f74bdb3161d5193c2d3667558faf1e 100644 (file)
@@ -1,62 +1,62 @@
---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===
index dbf4c62f5b077d29bf5247fe5390d6327ff85e17..e3a0fe272fc7f76cc2d6c9887deed53565d98e90 100644 (file)
@@ -1,65 +1,65 @@
---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===
index f2150e956dc59cebcfdc7a07c3ce90bd6bcdfabd..a215fef0a4493f97037364d867d07912110a22b2 100644 (file)
@@ -1,63 +1,63 @@
---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===
index 138a53a1191138b1c10c310355d57ed1d458c6f0..0c8d398dafad97593099304d894b6747c658f288 100644 (file)
@@ -1,65 +1,65 @@
---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===
index 016b35dd4b2961ff0ef90ce4d580b95ea6804c12..41f18ef9d238f5000c6afec3b9fa2e757c0bb353 100644 (file)
@@ -1,62 +1,62 @@
---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===
index 785b9338acc7b8fe050525e2aaef1ec068e10bc0..85a86e199654e4e07f3d14bbb842807a8b23bd6b 100644 (file)
@@ -1,64 +1,64 @@
---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===
index 293205876df172d2caba142ded3d6ebe5e779784..5724511a0e64ff41fa763000e973274f898f6b45 100644 (file)
@@ -1,63 +1,63 @@
---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===
index 055cfc673b7c7b7085984fbbfa5dad703f265cf7..f3b16c1fc917b1dd3f77352211d423d3d3a319f9 100644 (file)
@@ -1,63 +1,63 @@
---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===
index 62fedfad5a85577e3b8e717a63cba4fea012925c..4f468638dcd670af9be5755574044a133b922b4e 100644 (file)
@@ -1,60 +1,60 @@
---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===
index e6f16a3883bec62b2beb4b8eac0ab4d24b64a159..3ee274aea0caf0bd738db7e4ae94983435e413d0 100644 (file)
@@ -1,60 +1,60 @@
---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===
index 80754dacb4b5c98c7e5b0a5dffc694de5a1993d9..cef0be62790429907170c93781335dd7a15143a1 100644 (file)
@@ -1,65 +1,65 @@
---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===
index 2a0b57035dd6fda746081667de5eccf50cb27bad..25bbfc585982a75dd65099a4494836a2cdbd38fe 100644 (file)
@@ -1,63 +1,63 @@
---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===
index 16ec925cb89a6269d4e052fb23bcb6fa804df725..6fbc496fa5c6e3d29fde9a63a203446779df60c7 100644 (file)
@@ -1,65 +1,65 @@
---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===
index 143d72038b59082f09949f95d80c03694d8887ec..9f21ea4bcaf0a77b15ef4b69faf8b81af3ca890e 100644 (file)
@@ -1,65 +1,65 @@
---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===
index 702797ec8d614a5af392624a7e3d8b5146721938..a9fbcf60e10f0a1f3307d60d9898c23e34229086 100644 (file)
@@ -1,64 +1,64 @@
---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===
index 8a60cfdbb45480d97c7f2da9b9f8df61a1657b18..aa5aab7a59c982caa3c6465bce148b74f18ee2e3 100644 (file)
@@ -1,65 +1,65 @@
---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===
index 3dbdbb4197890ca3b83844dc546c482ca6e8d4d5..81b05167574c2cca16c61cd768c527e141bb4000 100644 (file)
@@ -1,94 +1,94 @@
---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===
index 9875df85ae6e905c6df083d95cbde89331bb7131..f3e825ca3d16cd2244acc12d3472988da297f90c 100644 (file)
@@ -1,61 +1,61 @@
---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===
index ee5a8cd4b7253956fc5c61b81bb47f2482af8fed..0db326d27e6d47e2df1bdc409d4cff73998f9b7c 100644 (file)
@@ -1,49 +1,49 @@
---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===
index 494259acd86fcbae44acce8f28050a73699e1cb4..18e8bddedd604f6bfd9515ec4e4f54efacd6faea 100644 (file)
@@ -1,61 +1,61 @@
---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===
index 6fbe8043193510975960a4d2f453b412e9e70a06..35e19888e18ade12042615947327444a91a8297f 100644 (file)
@@ -1,49 +1,49 @@
---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===
index c1b15fdf347f0a94365c9c5b6cf334933c640a38..b2b11709b315cf03fa596a1c6ad00ef621b72774 100644 (file)
@@ -1,32 +1,32 @@
---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 ---
@@ -56,5 +56,5 @@ float(9.2233720368548E+18)
 --- testing: -9223372036854775807 ---
 int(-9223372036854775808)
 --- testing: -9.2233720368548E+18 ---
-float(-9.2233720368548E+18)\r
-===DONE===\r
+float(-9.2233720368548E+18)
+===DONE===
index c7fb5744a015643d226ab8ed2c2793f8a4973e8b..1d1fade74d894de109c39aede21965275f0b2254 100644 (file)
@@ -1,22 +1,22 @@
---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' ---
@@ -44,5 +44,5 @@ string(7) "123abc "
 --- testing: '3.4a' ---
 string(4) "3.4a"
 --- testing: 'a5.9' ---
-string(4) "a5.9"\r
-===DONE===\r
+string(4) "a5.9"
+===DONE===
index 599aa4e001b648dbe8e0b44dd7ba770d0334e380..e24cc283aa75f0abeacb1e09b4aa55b1d383b838 100644 (file)
@@ -1,32 +1,32 @@
---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 ---
@@ -56,5 +56,5 @@ float(9.2233720368548E+18)
 --- testing: -9223372036854775807 ---
 int(-9223372036854775806)
 --- testing: -9.2233720368548E+18 ---
-float(-9.2233720368548E+18)\r
-===DONE===\r
+float(-9.2233720368548E+18)
+===DONE===
index f52b95144207dbcd39c09afb02a645a15e16bbfa..ca80e3f52d7165331781eb50d219042c1e3c9ebd 100644 (file)
@@ -1,44 +1,44 @@
---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 ---
@@ -578,5 +578,5 @@ float(0)
 --- testing: 9223372036854775807 - -9223372036854775807 ---
 float(1.844674407371E+19)
 --- testing: 9223372036854775807 - -9.2233720368548E+18 ---
-float(1.844674407371E+19)\r
-===DONE===\r
+float(1.844674407371E+19)
+===DONE===
index 5b5bae2e3556a2c09f2a3cafad724b3e47d9d848..51b5ed4dca8462bd7085384626e5b6db2ded6a66 100644 (file)
@@ -1,26 +1,26 @@
---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' ---
@@ -412,5 +412,5 @@ int(-123)
 --- testing: 'a5.9' - '3.4a' ---
 float(-3.4)
 --- testing: 'a5.9' - 'a5.9' ---
-int(0)\r
-===DONE===\r
+int(0)
+===DONE===
index 51e63b8694b030bf5fb26d8f24f7602fa8e0db15..1feccd4a97efd63dd92f3a9ae41f08dbb3f0aa84 100644 (file)
@@ -1,20 +1,20 @@
---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)
index 1c635b52980afd746b689eb29d7ec35b117de56c..99365f1b14414365ede01a19aab402c74cc7da25 100644 (file)
@@ -1,29 +1,29 @@
---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"
index 3f03037bf59cbdcc876178fce9a36e1a847f63e0..b14ae69549d49932a580bbbcf7e933672ccf44dd 100644 (file)
@@ -1,55 +1,55 @@
---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)
index f7d1165a2239811a5b3daf76d99651d6e0c72440..b37506ce0a4939c255ca5a4320e98c4343217ddc 100644 (file)
@@ -1,57 +1,57 @@
---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)
index 840b89fa53ac95a7d82d79244ab1db416f7cdb3c..adb11617c409943fbf6b18efc286537b8106238f 100644 (file)
@@ -1,58 +1,58 @@
---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)
index 4019f3ab4586d2fd35f3e21748b787000c63b72e..d2c7041be8047ddc2b7e1efce93496ed797ed0db 100644 (file)
@@ -1,60 +1,60 @@
---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)
index badb7365f5db8040e1ca72818a9745c83929532d..45fa0ddc880088a982ecfd00eb7223d051013cdf 100644 (file)
@@ -1,63 +1,63 @@
---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)
index 9c396be1bc1eb8cd239e4c473ffe618c93431954..3774a917c5c6a52886d4be094cf02f6f07df4ecb 100644 (file)
@@ -1,64 +1,64 @@
---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)
index 63203757de4c646f8f2d321440e206676c86c453..9e7470edbc231d42a2d1e409fe5e3d021d618b70 100644 (file)
@@ -1,39 +1,39 @@
---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)
index 267b8dc67b6c8b88e682d9eac9249db9d082b2f7..d3526b5a2fb9ddce814f3ecd24217ebed85e67e2 100644 (file)
-/*\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 %*");
index 2974bfbd485950e651f67aea5e35c5fc91c6b2a2..54184159d0602604f681b919c672fa0ee1752203 100644 (file)
@@ -1,5 +1,5 @@
-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"