diff options
210 files changed, 12159 insertions, 12159 deletions
diff --git a/Zend/tests/bug55509.phpt b/Zend/tests/bug55509.phpt index 5268789df6..4fc3299620 100644 --- a/Zend/tests/bug55509.phpt +++ b/Zend/tests/bug55509.phpt @@ -1,71 +1,71 @@ ---TEST--
-Bug #55509 (segfault on x86_64 using more than 2G memory)
---SKIPIF--
-<?php
-if (PHP_INT_SIZE == 4) {
- die('skip Not for 32-bits OS');
-}
-
-$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
-if ($zend_mm_enabled === "0") {
- die("skip Zend MM disabled");
-}
-
-if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-// check the available memory
-if (PHP_OS == 'Linux') {
- $lines = file('/proc/meminfo');
- $infos = array();
- foreach ($lines as $line) {
- $tmp = explode(":", $line);
- $index = strtolower($tmp[0]);
- $value = (int)ltrim($tmp[1], " ")*1024;
- $infos[$index] = $value;
- }
- $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
- if ($freeMemory < 2100*1024*1024) {
- die('skip Not enough memory.');
- }
-}
-elseif (PHP_OS == 'FreeBSD') {
- $lines = explode("\n",`sysctl -a`);
- $infos = array();
- foreach ($lines as $line) {
- if(!$line){
- continue;
- }
- $tmp = explode(":", $line);
- $index = strtolower($tmp[0]);
- $value = trim($tmp[1], " ");
- $infos[$index] = $value;
- }
- $freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])
- +($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])
- +($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);
- if ($freeMemory < 2100*1024*1024) {
- die('skip Not enough memory.');
- }
-}
-?>
---INI--
-memory_limit=2100M
---FILE--
-<?php
-$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
-echo "1\n";
-$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
-echo "2\n";
-$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
-echo "3\n";
-$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
-echo "4\n";
-$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
-echo "5\n";
-?>
---EXPECTF--
-1
-2
-3
-4
-
-Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d
+--TEST-- +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 diff --git a/Zend/tests/bug64979.phpt b/Zend/tests/bug64979.phpt index 5bc8e5a6ab..6122ccf270 100644 --- a/Zend/tests/bug64979.phpt +++ b/Zend/tests/bug64979.phpt @@ -1,30 +1,30 @@ ---TEST--
-Bug #64979 (Wrong behavior of static variables in closure generators)
---FILE--
-<?php
-
-function new_closure_gen() {
- return function() {
- static $foo = 0;
- yield ++$foo;
- };
-}
-
-$closure1 = new_closure_gen();
-$closure2 = new_closure_gen();
-
-$gen1 = $closure1();
-$gen2 = $closure1();
-$gen3 = $closure2();
-
-foreach (array($gen1, $gen2, $gen3) as $gen) {
- foreach ($gen as $val) {
- var_dump($val);
- }
-}
-
-?>
---EXPECT--
-int(1)
-int(2)
-int(1)
+--TEST-- +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) diff --git a/Zend/tests/bug71474.phpt b/Zend/tests/bug71474.phpt index e67bb9b240..72b0db91a1 100644 --- a/Zend/tests/bug71474.phpt +++ b/Zend/tests/bug71474.phpt @@ -1,23 +1,23 @@ ---TEST--
-Bug #71474: Crash because of VM stack corruption on Magento2
---FILE--
-<?php
-class foo {
- function __call($name, $args) {
- $a = $b = $c = $d = $e = $f = 1;
- }
-}
-
-function test($n, $x) {
-// var_dump($n);
- if ($n > 0) {
- $x->bug();
- test($n - 1, $x);
- }
-}
-
-test(3000, new foo());
-echo "OK\n";
-?>
---EXPECT--
-OK
+--TEST-- +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 diff --git a/Zend/tests/bug72918.phpt b/Zend/tests/bug72918.phpt index f3dc1d2918..403d4e69c5 100644 --- a/Zend/tests/bug72918.phpt +++ b/Zend/tests/bug72918.phpt @@ -1,22 +1,22 @@ ---TEST--
-Bug #72918 (negative offset inside a quoted string leads to parse error)
---FILE--
-<?php
-$array = [-3 => 'foo'];
-$string = 'abcde';
-
-echo "$array[-3]\n";
-echo "$string[-3]\n";
-echo <<<EOT
-$array[-3]
-$string[-3]
-
-EOT;
-?>
-===DONE===
---EXPECT--
-foo
-c
-foo
-c
-===DONE===
+--TEST-- +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=== diff --git a/Zend/tests/str_offset_002.phpt b/Zend/tests/str_offset_002.phpt index 2f5e4ee890..d3a9152905 100644 --- a/Zend/tests/str_offset_002.phpt +++ b/Zend/tests/str_offset_002.phpt @@ -1,12 +1,12 @@ ---TEST--
-string offset 002
---FILE--
-<?php
-$a = "aaa";
-$x = array(&$a[1]);
-?>
---EXPECTF--
-Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3
-Stack trace:
-#0 {main}
- thrown in %sstr_offset_002.php on line 3
+--TEST-- +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 diff --git a/Zend/tests/traits/bugs/case-sensitive.phpt b/Zend/tests/traits/bugs/case-sensitive.phpt index 13d4188f2f..6a65ccff03 100644 --- a/Zend/tests/traits/bugs/case-sensitive.phpt +++ b/Zend/tests/traits/bugs/case-sensitive.phpt @@ -1,23 +1,23 @@ ---TEST--
-Check for problems with case sensitivity in compositions
---FILE--
-<?php
-error_reporting(E_ALL);
-
-trait A {
- public function M1() {}
- public function M2() {}
-}
-
-trait B {
- public function M1() {}
- public function M2() {}
-}
-
-class MyClass {
- use A;
- use B;
-}
-?>
---EXPECTF--
-Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
+--TEST-- +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 diff --git a/Zend/tests/traits/static_001.phpt b/Zend/tests/traits/static_001.phpt index d86cb851b9..5953c008d5 100644 --- a/Zend/tests/traits/static_001.phpt +++ b/Zend/tests/traits/static_001.phpt @@ -1,22 +1,22 @@ ---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-- +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 diff --git a/Zend/tests/traits/static_002.phpt b/Zend/tests/traits/static_002.phpt index c076085519..64ebf6bf14 100644 --- a/Zend/tests/traits/static_002.phpt +++ b/Zend/tests/traits/static_002.phpt @@ -1,23 +1,23 @@ ---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-- +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 diff --git a/Zend/tests/traits/static_003.phpt b/Zend/tests/traits/static_003.phpt index fbe5421c71..01953cf724 100644 --- a/Zend/tests/traits/static_003.phpt +++ b/Zend/tests/traits/static_003.phpt @@ -1,27 +1,27 @@ ---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-- +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 diff --git a/Zend/tests/traits/static_004.phpt b/Zend/tests/traits/static_004.phpt index c360f457f0..3c3f380908 100644 --- a/Zend/tests/traits/static_004.phpt +++ b/Zend/tests/traits/static_004.phpt @@ -1,22 +1,22 @@ ---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-- +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 diff --git a/Zend/tests/traits/static_forward_static_call.phpt b/Zend/tests/traits/static_forward_static_call.phpt index 878cf1fcc1..9cda8aee1d 100644 --- a/Zend/tests/traits/static_forward_static_call.phpt +++ b/Zend/tests/traits/static_forward_static_call.phpt @@ -1,28 +1,28 @@ ---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--
+--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 diff --git a/Zend/tests/traits/static_get_called_class.phpt b/Zend/tests/traits/static_get_called_class.phpt index dc29ecefa2..bd7a603712 100644 --- a/Zend/tests/traits/static_get_called_class.phpt +++ b/Zend/tests/traits/static_get_called_class.phpt @@ -1,24 +1,24 @@ ---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--
+--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 diff --git a/Zend/tests/traits/trait_constant_001.phpt b/Zend/tests/traits/trait_constant_001.phpt index 0fd8ff921b..590949c2f6 100644 --- a/Zend/tests/traits/trait_constant_001.phpt +++ b/Zend/tests/traits/trait_constant_001.phpt @@ -1,36 +1,36 @@ ---TEST--
-__TRAIT__: Basics, a constant denoiting the trait of definition.
---FILE--
-<?php
-
-trait TestTrait {
- public static function test() {
- return __TRAIT__;
- }
-}
-
-class Direct {
- use TestTrait;
-}
-
-class IndirectInheritance extends Direct {
-
-}
-
-trait TestTraitIndirect {
- use TestTrait;
-}
-
-class Indirect {
- use TestTraitIndirect;
-}
-
-echo Direct::test()."\n";
-echo IndirectInheritance::test()."\n";
-echo Indirect::test()."\n";
-
-?>
---EXPECT--
-TestTrait
-TestTrait
-TestTrait
+--TEST-- +__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 diff --git a/Zend/tests/traits/trait_constant_002.phpt b/Zend/tests/traits/trait_constant_002.phpt index 327dd44a64..bbafbf210e 100644 --- a/Zend/tests/traits/trait_constant_002.phpt +++ b/Zend/tests/traits/trait_constant_002.phpt @@ -1,27 +1,27 @@ ---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) ""
+--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 diff --git a/ext/curl/tests/curl_version_error.phpt b/ext/curl/tests/curl_version_error.phpt index a9b80c55be..39f99a0fad 100644 --- a/ext/curl/tests/curl_version_error.phpt +++ b/ext/curl/tests/curl_version_error.phpt @@ -1,28 +1,28 @@ ---TEST--
-Test curl_version() function : error conditions
---SKIPIF--
-<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
---FILE--
-<?php
-
-/* Prototype : array curl_version ([ int $age ] )
- * Description: Returns information about the cURL version.
- * Source code: ext/curl/interface.c
-*/
-
-echo "*** Testing curl_version() : error conditions ***\n";
-
-echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( curl_version(1, $extra_arg) );
-
-?>
-===Done===
---EXPECTF--
-*** Testing curl_version() : error conditions ***
-
--- Testing curl_version() function with more than expected no. of arguments --
-
-Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-===Done===
+--TEST-- +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=== diff --git a/ext/curl/tests/curl_version_variation1.phpt b/ext/curl/tests/curl_version_variation1.phpt index 65f5e69acb..7c0106cb6a 100644 --- a/ext/curl/tests/curl_version_variation1.phpt +++ b/ext/curl/tests/curl_version_variation1.phpt @@ -1,159 +1,159 @@ ---TEST--
-Test curl_version() function : usage variations - test values for $ascii argument
---SKIPIF--
-<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
-if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
---FILE--
-<?php
-
-/* Prototype : array curl_version ([ int $age ] )
- * Description: Returns information about the cURL version.
- * Source code: ext/curl/interface.c
-*/
-
-echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
-
-//get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
-//defining a class
-class sample {
- public function __toString() {
- return "sample object";
- }
-}
-
-//getting the resource
-$file_handle = fopen(__FILE__, "r");
-
-// array with different values for $input
-$inputs = array (
-
- // integer values
- 0,
- 1,
- 255,
- 256,
- PHP_INT_MAX,
- -PHP_INT_MAX,
-
- // float values
- 10.5,
- -20.5,
- 10.1234567e10,
-
- // array values
- array(),
- array(0),
- array(1, 2),
-
- //string values
- "ABC",
- 'abc',
- "2abc",
-
- // boolean values
- true,
- false,
- TRUE,
- FALSE,
-
- // null values
- NULL,
- null,
-
- // objects
- new sample(),
-
- // resource
- $file_handle,
-
- // undefined variable
- @$undefined_var,
-
- // unset variable
- @$unset_var
-);
-
-// loop through with each element of the $inputs array to test curl_version() function
-$count = 1;
-foreach($inputs as $input) {
- echo "-- Iteration $count --\n";
- var_dump( is_array(curl_version($input)) );
- $count ++;
-}
-
-fclose($file_handle); //closing the file handle
-
-?>
-===Done===
---EXPECTF--
-*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
--- Iteration 1 --
-bool(true)
--- Iteration 2 --
-bool(true)
--- Iteration 3 --
-bool(true)
--- Iteration 4 --
-bool(true)
--- Iteration 5 --
-bool(true)
--- Iteration 6 --
-bool(true)
--- Iteration 7 --
-bool(true)
--- Iteration 8 --
-bool(true)
--- Iteration 9 --
-bool(true)
--- Iteration 10 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 11 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 12 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 13 --
-
-Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
-bool(false)
--- Iteration 14 --
-
-Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
-bool(false)
--- Iteration 15 --
-
-Notice: A non well formed numeric value encountered in %s on line %d
-bool(true)
--- Iteration 16 --
-bool(true)
--- Iteration 17 --
-bool(true)
--- Iteration 18 --
-bool(true)
--- Iteration 19 --
-bool(true)
--- Iteration 20 --
-bool(true)
--- Iteration 21 --
-bool(true)
--- Iteration 22 --
-
-Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
-bool(false)
--- Iteration 23 --
-
-Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
-bool(false)
--- Iteration 24 --
-bool(true)
--- Iteration 25 --
-bool(true)
-===Done===
+--TEST-- +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=== diff --git a/ext/filter/tests/bug47435.phpt b/ext/filter/tests/bug47435.phpt index 957a00194a..9388679ebb 100644 --- a/ext/filter/tests/bug47435.phpt +++ b/ext/filter/tests/bug47435.phpt @@ -1,36 +1,36 @@ ---TEST--
-Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
---SKIPIF--
-<?php if (!extension_loaded("filter")) die("skip"); ?>
---FILE--
-<?php
-var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE));
-var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-?>
---EXPECT--
-string(7) "FC00::1"
-bool(false)
-string(2) "::"
-bool(false)
-string(3) "::1"
-bool(false)
-string(10) "fe8:5:6::1"
-bool(false)
-string(12) "2001:0db8::1"
-bool(false)
-string(5) "5f::1"
-bool(false)
-string(7) "3ff3::1"
-bool(false)
+--TEST-- +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) diff --git a/ext/filter/tests/bug49274.phpt b/ext/filter/tests/bug49274.phpt index c87e6be1c7..2adc6ed977 100644 --- a/ext/filter/tests/bug49274.phpt +++ b/ext/filter/tests/bug49274.phpt @@ -1,10 +1,10 @@ ---TEST--
-#49274, fatal error when an object does not implement toString
---SKIPIF--
-<?php if (!extension_loaded("filter")) die("skip"); ?>
---FILE--
-<?php
-var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));
-?>
---EXPECTF--
-bool(false)
+--TEST-- +#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) diff --git a/ext/gd/tests/bug42434.phpt b/ext/gd/tests/bug42434.phpt index bc0790ede4..9067500090 100644 --- a/ext/gd/tests/bug42434.phpt +++ b/ext/gd/tests/bug42434.phpt @@ -1,27 +1,27 @@ ---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--
+--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 diff --git a/ext/gd/tests/bug47946.phpt b/ext/gd/tests/bug47946.phpt index c84508509c..aeea7fb324 100644 --- a/ext/gd/tests/bug47946.phpt +++ b/ext/gd/tests/bug47946.phpt @@ -1,51 +1,51 @@ ---TEST--
-Bug #47946 (ImageConvolution overwrites background)
---DESCRIPTION--
-The expected image has black pixel artifacts, what is another issue, though
-(perhaps #40158).
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-function array_flatten($array)
-{
- $tempArray = array();
-
- foreach ($array as $value) {
- if (is_array($value)) {
- $tempArray = array_merge($tempArray, array_flatten($value));
- } else {
- $tempArray[] = $value;
- }
- }
-
- return $tempArray;
-}
-
-function makeFilter($resource, $matrix, $offset = 1.0)
-{
- $divisor = array_sum(array_flatten($matrix));
- if ($divisor == 0) {
- $divisor = .01;
- }
- return imageconvolution($resource, $matrix, $divisor, $offset);
-}
-
-$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
-
-$im = imagecreatetruecolor(40, 40);
-imagealphablending($im, false);
-imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);
-imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);
-imagesavealpha($im, true);
-makeFilter($im, $edgeMatrix);
-
-require_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST-- +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=== diff --git a/ext/gd/tests/bug52070.phpt b/ext/gd/tests/bug52070.phpt index acf56e6b5b..d44a527479 100644 --- a/ext/gd/tests/bug52070.phpt +++ b/ext/gd/tests/bug52070.phpt @@ -1,25 +1,25 @@ ---TEST--
-Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreate(1200, 800);
-$background_color = imagecolorallocate($im, 40, 40, 40);
-$color = imagecolorallocate($im, 255, 255, 255);
-imagedashedline($im, 800, 400, 300, 400, $color);
-imagedashedline($im, 800, 400, 300, 800, $color);
-imagedashedline($im, 800, 400, 400, 800, $color);
-imagedashedline($im, 800, 400, 500, 800, $color);
-imagedashedline($im, 800, 400, 600, 800, $color);
-imagedashedline($im, 800, 400, 700, 800, $color);
-imagedashedline($im, 800, 400, 800, 800, $color);
-include_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/bug52070.png', $im);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST-- +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=== diff --git a/ext/gd/tests/bug53156.phpt b/ext/gd/tests/bug53156.phpt index 9e1fec8798..ceb37c13c4 100644 --- a/ext/gd/tests/bug53156.phpt +++ b/ext/gd/tests/bug53156.phpt @@ -1,60 +1,60 @@ ---TEST--
-Bug #53156 (imagerectangle problem with point ordering)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
- die("skip test requires GD 2.3 or newer");
-}
-?>
---FILE--
-<?php
-function draw_and_check_pixel($x, $y)
-{
- global $img, $black, $red;
-
- echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
- imagesetpixel($img, $x, $y, $red);
-}
-
-function draw_and_check_rectangle($x1, $y1, $x2, $y2)
-{
- global $img, $black;
-
- echo 'Rectangle: ';
- imagerectangle($img, $x1, $y1, $x2, $y2, $black);
- $x = ($x1 + $x2) / 2;
- $y = ($y1 + $y2) / 2;
- draw_and_check_pixel($x, $y1);
- draw_and_check_pixel($x1, $y);
- draw_and_check_pixel($x, $y2);
- draw_and_check_pixel($x2, $y);
- echo PHP_EOL;
-}
-
-$img = imagecreate(110, 210);
-$bgnd = imagecolorallocate($img, 255, 255, 255);
-$black = imagecolorallocate($img, 0, 0, 0);
-$red = imagecolorallocate($img, 255, 0, 0);
-
-draw_and_check_rectangle( 10, 10, 50, 50);
-draw_and_check_rectangle( 50, 60, 10, 100);
-draw_and_check_rectangle( 50, 150, 10, 110);
-draw_and_check_rectangle( 10, 200, 50, 160);
-imagesetthickness($img, 4);
-draw_and_check_rectangle( 60, 10, 100, 50);
-draw_and_check_rectangle(100, 60, 60, 100);
-draw_and_check_rectangle(100, 150, 60, 110);
-draw_and_check_rectangle( 60, 200, 100, 160);
-
-//imagepng($img, __DIR__ . '/bug53156.png'); // debug
-?>
---EXPECT--
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
+--TEST-- +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: ++++ diff --git a/ext/gd/tests/bug72494.phpt b/ext/gd/tests/bug72494.phpt index f21de6ca3b..4cca9aec8e 100644 --- a/ext/gd/tests/bug72494.phpt +++ b/ext/gd/tests/bug72494.phpt @@ -1,15 +1,15 @@ ---TEST--
-Bug #72494 (imagecropauto out-of-bounds access)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreate(10,10);
-imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
-?>
-===DONE===
---EXPECTF--
-Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
-===DONE===
+--TEST-- +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=== diff --git a/ext/gd/tests/bug73272.phpt b/ext/gd/tests/bug73272.phpt index 3bb710cdc7..ccee8d6e67 100644 --- a/ext/gd/tests/bug73272.phpt +++ b/ext/gd/tests/bug73272.phpt @@ -1,24 +1,24 @@ ---TEST--
-Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
-
-$src = imagecreatetruecolor(100, 100);
-imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
-imageellipse($src, 49,49, 40,40, 0x000000);
-
-imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
-imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-$dst = imagerotate($src, 60, 0xFFFFFF);
-
-test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST-- +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=== diff --git a/ext/gd/tests/bug73279.phpt b/ext/gd/tests/bug73279.phpt index e6c6709039..aba91f0d3a 100644 --- a/ext/gd/tests/bug73279.phpt +++ b/ext/gd/tests/bug73279.phpt @@ -1,20 +1,20 @@ ---TEST--
-Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
- die('skip only for bundled libgd or external libgd >= 2.2.4');
-}
-?>
---FILE--
-<?php
-$src = imagecreate(100, 100);
-imagecolorallocate($src, 255, 255, 255);
-$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-printf("color: %x\n", imagecolorat($dst, 99, 99));
-?>
-===DONE===
---EXPECT--
-color: ffffff
-===DONE===
+--TEST-- +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=== diff --git a/ext/gd/tests/bug73279_old.phpt b/ext/gd/tests/bug73279_old.phpt index 0cbbec34f2..810b15201f 100644 --- a/ext/gd/tests/bug73279_old.phpt +++ b/ext/gd/tests/bug73279_old.phpt @@ -1,22 +1,22 @@ ---TEST--
-Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
- die('skip only for external libgd < 2.2.4');
-}
-?>
---FILE--
-<?php
-$src = imagecreate(100, 100);
-imagecolorallocate($src, 255, 255, 255);
-$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-printf("color: %x\n", imagecolorat($dst, 99, 99));
-?>
-===DONE===
---XFAIL--
-Bug #330 has not yet been fixed
---EXPECT--
-color: ffffff
-===DONE===
+--TEST-- +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=== diff --git a/ext/gd/tests/bug73968.phpt b/ext/gd/tests/bug73968.phpt index fd17fe26ba..2211840f58 100644 --- a/ext/gd/tests/bug73968.phpt +++ b/ext/gd/tests/bug73968.phpt @@ -1,15 +1,15 @@ ---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===
+--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=== diff --git a/ext/gd/tests/func.inc b/ext/gd/tests/func.inc index 708fccd3d1..1928ff696a 100644 --- a/ext/gd/tests/func.inc +++ b/ext/gd/tests/func.inc @@ -1,148 +1,148 @@ -<?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);
-}
+<?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); +} diff --git a/ext/gd/tests/imagecrop_auto-ext.phpt b/ext/gd/tests/imagecrop_auto-ext.phpt index 60291a69c0..f37b3ca8e2 100644 --- a/ext/gd/tests/imagecrop_auto-ext.phpt +++ b/ext/gd/tests/imagecrop_auto-ext.phpt @@ -1,85 +1,85 @@ ---TEST--
-Testing imagecropauto()
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
-if (GD_BUNDLED) die('skip requires external libgd');
-?>
---FILE--
-<?php
-
-echo "TC IMG_CROP_DEFAULT\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_DEFAULT\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_SIDES\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_SIDES\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_BLACK\n";
-$im = imagecreatetruecolor(50, 50);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_BLACK\n";
-$im = imagecreate(50, 50);
-$bgd = imagecolorallocate($im, 0, 0, 0);
-$b = imagecolorallocate($im, 0, 0, 255);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "IMG_CROP_THRESHOLD\n";
-$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
-$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
-imagepng($im_crop, __DIR__ . "/crop_threshold.png");
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-@unlink(__DIR__ . "/crop_threshold.png");
-?>
---EXPECT--
-TC IMG_CROP_DEFAULT
-int(99)
-int(99)
-Palette IMG_CROP_DEFAULT
-int(99)
-int(99)
-TC IMG_CROP_SIDES
-int(11)
-int(11)
-Palette IMG_CROP_SIDES
-int(11)
-int(11)
-TC IMG_CROP_BLACK
-int(11)
-int(11)
-Palette IMG_CROP_BLACK
-int(11)
-int(11)
-IMG_CROP_THRESHOLD
-int(240)
-int(134)
+--TEST-- +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) diff --git a/ext/gd/tests/imagecrop_auto.phpt b/ext/gd/tests/imagecrop_auto.phpt index 8a0f79d324..07f6b8ae4c 100644 --- a/ext/gd/tests/imagecrop_auto.phpt +++ b/ext/gd/tests/imagecrop_auto.phpt @@ -1,85 +1,85 @@ ---TEST--
-Testing imagecropauto()
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
-if (!GD_BUNDLED) die('skip requires bundled libgd');
-?>
---FILE--
-<?php
-
-echo "TC IMG_CROP_DEFAULT\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_DEFAULT\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_SIDES\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_SIDES\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_BLACK\n";
-$im = imagecreatetruecolor(50, 50);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_BLACK\n";
-$im = imagecreate(50, 50);
-$bgd = imagecolorallocate($im, 0, 0, 0);
-$b = imagecolorallocate($im, 0, 0, 255);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "IMG_CROP_THRESHOLD\n";
-$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
-$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
-imagepng($im_crop, __DIR__ . "/crop_threshold.png");
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-@unlink(__DIR__ . "/crop_threshold.png");
-?>
---EXPECT--
-TC IMG_CROP_DEFAULT
-int(11)
-int(11)
-Palette IMG_CROP_DEFAULT
-int(11)
-int(11)
-TC IMG_CROP_SIDES
-int(11)
-int(11)
-Palette IMG_CROP_SIDES
-int(11)
-int(11)
-TC IMG_CROP_BLACK
-int(11)
-int(11)
-Palette IMG_CROP_BLACK
-int(11)
-int(11)
-IMG_CROP_THRESHOLD
-int(240)
-int(134)
+--TEST-- +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) diff --git a/ext/gd/tests/imageellipse_error8.phpt b/ext/gd/tests/imageellipse_error8.phpt index 3fefb56bde..d02b97eec3 100644 --- a/ext/gd/tests/imageellipse_error8.phpt +++ b/ext/gd/tests/imageellipse_error8.phpt @@ -1,21 +1,21 @@ ---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--
+--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 diff --git a/ext/gd/tests/imagefilltoborder_error7.phpt b/ext/gd/tests/imagefilltoborder_error7.phpt index aeb7d82620..f3313e11f4 100644 --- a/ext/gd/tests/imagefilltoborder_error7.phpt +++ b/ext/gd/tests/imagefilltoborder_error7.phpt @@ -1,26 +1,26 @@ ---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--
+--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 diff --git a/ext/gd/tests/imageflip.phpt b/ext/gd/tests/imageflip.phpt index a326e0a2ba..f4660940a2 100644 --- a/ext/gd/tests/imageflip.phpt +++ b/ext/gd/tests/imageflip.phpt @@ -1,30 +1,30 @@ ---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"
+--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 diff --git a/ext/gd/tests/imagerectangle_basic.phpt b/ext/gd/tests/imagerectangle_basic.phpt index 507d715326..d23cbdfe79 100644 --- a/ext/gd/tests/imagerectangle_basic.phpt +++ b/ext/gd/tests/imagerectangle_basic.phpt @@ -1,22 +1,22 @@ ---TEST--
-Testing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
-
-include_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
-?>
---EXPECT--
-The images are equal.
+--TEST-- +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. diff --git a/ext/gd/tests/imagerectangle_error1.phpt b/ext/gd/tests/imagerectangle_error1.phpt index 2b4235e854..3b9e8d3f0c 100644 --- a/ext/gd/tests/imagerectangle_error1.phpt +++ b/ext/gd/tests/imagerectangle_error1.phpt @@ -1,19 +1,19 @@ ---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--
+--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 diff --git a/ext/gd/tests/imagerectangle_error2.phpt b/ext/gd/tests/imagerectangle_error2.phpt index 5fc1914ad0..63525d2cb7 100644 --- a/ext/gd/tests/imagerectangle_error2.phpt +++ b/ext/gd/tests/imagerectangle_error2.phpt @@ -1,19 +1,19 @@ ---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--
+--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 diff --git a/ext/gd/tests/imagerectangle_error3.phpt b/ext/gd/tests/imagerectangle_error3.phpt index eceab1e99b..350ee1bf82 100644 --- a/ext/gd/tests/imagerectangle_error3.phpt +++ b/ext/gd/tests/imagerectangle_error3.phpt @@ -1,19 +1,19 @@ ---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--
+--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 diff --git a/ext/gd/tests/imagerectangle_error4.phpt b/ext/gd/tests/imagerectangle_error4.phpt index 5d8e1cecac..4c448dc027 100644 --- a/ext/gd/tests/imagerectangle_error4.phpt +++ b/ext/gd/tests/imagerectangle_error4.phpt @@ -1,19 +1,19 @@ ---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--
+--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 diff --git a/ext/gd/tests/imagerectangle_error5.phpt b/ext/gd/tests/imagerectangle_error5.phpt index df9c457d6f..fa9486e3de 100644 --- a/ext/gd/tests/imagerectangle_error5.phpt +++ b/ext/gd/tests/imagerectangle_error5.phpt @@ -1,19 +1,19 @@ ---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--
+--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 diff --git a/ext/gd/tests/imagerectangle_error6.phpt b/ext/gd/tests/imagerectangle_error6.phpt index a91c6bbc0c..1523a9ec57 100644 --- a/ext/gd/tests/imagerectangle_error6.phpt +++ b/ext/gd/tests/imagerectangle_error6.phpt @@ -1,19 +1,19 @@ ---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--
+--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 diff --git a/ext/gd/tests/imagerectangle_error7.phpt b/ext/gd/tests/imagerectangle_error7.phpt index f819da6e6c..ee6326feff 100644 --- a/ext/gd/tests/imagerectangle_error7.phpt +++ b/ext/gd/tests/imagerectangle_error7.phpt @@ -1,19 +1,19 @@ ---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--
+--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 diff --git a/ext/gd/tests/imagerectangle_error8.phpt b/ext/gd/tests/imagerectangle_error8.phpt index 361de69cde..cb0746e492 100644 --- a/ext/gd/tests/imagerectangle_error8.phpt +++ b/ext/gd/tests/imagerectangle_error8.phpt @@ -1,19 +1,19 @@ ---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--
+--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 diff --git a/ext/gd/tests/test_image_equals_file_palette.phpt b/ext/gd/tests/test_image_equals_file_palette.phpt index 130fa43202..0cfea7f415 100644 --- a/ext/gd/tests/test_image_equals_file_palette.phpt +++ b/ext/gd/tests/test_image_equals_file_palette.phpt @@ -1,42 +1,42 @@ ---TEST--
-test_image_equals_file(): comparing palette images
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-$red = imagecolorallocate($im, 255, 0, 0);
-imagefilledrectangle($im, 3,3, 7,7, $red);
-
-$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
-imagepng($im, $filename);
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-$blue = imagecolorallocate($im, 0, 0, 255);
-imagefilledrectangle($im, 3,3, 7,7, $blue);
-
-test_image_equals_file($filename, $im);
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-imagecolorallocate($im, 0, 0, 0);
-$red = imagecolorallocate($im, 255, 0, 0);
-imagefilledrectangle($im, 3,3, 7,7, $red);
-
-test_image_equals_file($filename, $im);
-?>
-===DONE===
---EXPECT--
-The images differ in 25 pixels.
-The images are equal.
-===DONE===
---CLEAN--
-<?php
-unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
-?>
+--TEST-- +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'); +?> diff --git a/ext/gd/tests/webp_basic.phpt b/ext/gd/tests/webp_basic.phpt index 55436741db..593e43c807 100644 --- a/ext/gd/tests/webp_basic.phpt +++ b/ext/gd/tests/webp_basic.phpt @@ -1,38 +1,38 @@ ---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)
+--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) diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt index 324e229de5..618fcdb0d4 100644 --- a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt +++ b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt @@ -31,4 +31,4 @@ int(0) int(0) int(0) int(1) -==DONE==
+==DONE== diff --git a/ext/intl/tests/calendar_getNow_basic.phpt b/ext/intl/tests/calendar_getNow_basic.phpt index 2df112d7b2..3f1c2488b3 100644 --- a/ext/intl/tests/calendar_getNow_basic.phpt +++ b/ext/intl/tests/calendar_getNow_basic.phpt @@ -20,4 +20,4 @@ var_dump(abs($time * 1000 - $proc_now) < 2000); --EXPECT-- bool(true) bool(true) -==DONE==
+==DONE== diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt index 998e74bc01..ac437f962b 100644 --- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt +++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt @@ -23,4 +23,4 @@ bool(true) int(6) bool(true) int(5) -==DONE==
+==DONE== diff --git a/ext/intl/tests/dateformat_formatObject_calendar.phpt b/ext/intl/tests/dateformat_formatObject_calendar.phpt index 9365387ce6..b2b08f362d 100644 --- a/ext/intl/tests/dateformat_formatObject_calendar.phpt +++ b/ext/intl/tests/dateformat_formatObject_calendar.phpt @@ -1,41 +1,41 @@ ---TEST--
-IntlDateFormatter::formatObject(): IntlCalendar tests
---SKIPIF--
-<?php
-if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
-<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-ini_set("intl.default_locale", "pt_PT");
-ini_set("date.timezone", "Europe/Lisbon");
-
-$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
-echo IntlDateFormatter::formatObject($cal), "\n";
-echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
-echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
-echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
-echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
-
-$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
-echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
-
-$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
-$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
-echo IntlDateFormatter::formatObject($cal), "\n";
-echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
-
-?>
-==DONE==
-
---EXPECTF--
-01/01/2012 00:00:00
-Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
-Jan 1, 2012 12:00:00 AM
-1/1/12 12:00:00 AM Western European %STime
-Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
-Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
-06/02/1433 00:00:00
-Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
-==DONE==
-
+--TEST-- +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== + diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt index d59c635a7d..688ccc31bf 100644 --- a/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt +++ b/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt @@ -1,10 +1,10 @@ ---TEST--
-IntlDateFormatter::formatObject(): IntlCalendar tests
---SKIPIF--
-<?php
+--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--
+--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== -
---EXPECTF--
+ +--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 diff --git a/ext/intl/tests/dateformat_formatObject_datetime.phpt b/ext/intl/tests/dateformat_formatObject_datetime.phpt index 2c9e1e33be..a2cba4c76b 100644 --- a/ext/intl/tests/dateformat_formatObject_datetime.phpt +++ b/ext/intl/tests/dateformat_formatObject_datetime.phpt @@ -1,34 +1,34 @@ ---TEST--
-IntlDateFormatter::formatObject(): DateTime tests
---SKIPIF--
-<?php
-if (!extension_loaded('intl')) die('skip intl extension not enabled') ?>
-<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-ini_set("intl.default_locale", "pt_PT");
-ini_set("date.timezone", "Europe/Lisbon");
-
-$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
-echo IntlDateFormatter::formatObject($dt), "\n";
-echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
-echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
-echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
-echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
-
-$dt = new DateTime('2012-01-01 05:00:00+03:00');
-echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
-
-?>
-==DONE==
-
---EXPECTF--
-01/01/2012 00:00:00
-Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
-Jan 1, 2012 12:00:00 AM
-1/1/12 12:00:00 AM Western European %STime
-Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
-Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
-==DONE==
-
+--TEST-- +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== + diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt index b4e59f5b7e..567a7eb849 100644 --- a/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt +++ b/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt @@ -1,10 +1,10 @@ ---TEST--
-IntlDateFormatter::formatObject(): DateTime tests
---SKIPIF--
-<?php
+--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--
+--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== -
---EXPECTF--
+ +--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 diff --git a/ext/intl/tests/dateformat_formatObject_error.phpt b/ext/intl/tests/dateformat_formatObject_error.phpt index 7aaf69e54e..221602d135 100644 --- a/ext/intl/tests/dateformat_formatObject_error.phpt +++ b/ext/intl/tests/dateformat_formatObject_error.phpt @@ -1,10 +1,10 @@ ---TEST--
-IntlDateFormatter::formatObject(): error conditions
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
+--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== -
---EXPECTF--
+ +--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== -
+ diff --git a/ext/intl/tests/resourcebundle.build b/ext/intl/tests/resourcebundle.build index 6a7eeae5eb..560dc8fb45 100644 --- a/ext/intl/tests/resourcebundle.build +++ b/ext/intl/tests/resourcebundle.build @@ -1,33 +1,33 @@ -<?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");
-
+<?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 diff --git a/ext/intl/tests/timezone_createDefault_basic.phpt b/ext/intl/tests/timezone_createDefault_basic.phpt index 1988d3b9e5..f8e3158cec 100644 --- a/ext/intl/tests/timezone_createDefault_basic.phpt +++ b/ext/intl/tests/timezone_createDefault_basic.phpt @@ -28,4 +28,4 @@ IntlTimeZone Object [rawOffset] => %i [currentOffset] => %i ) -==DONE==
+==DONE== diff --git a/ext/intl/tests/timezone_getCanonicalID_variant1.phpt b/ext/intl/tests/timezone_getCanonicalID_variant1.phpt index d600792d7c..182fe15b60 100644 --- a/ext/intl/tests/timezone_getCanonicalID_variant1.phpt +++ b/ext/intl/tests/timezone_getCanonicalID_variant1.phpt @@ -20,4 +20,4 @@ string(13) "Europe/Lisbon" bool(true) string(0) "" bool(false) -==DONE==
+==DONE== diff --git a/ext/intl/tests/timezone_getDisplayName_variant4.phpt b/ext/intl/tests/timezone_getDisplayName_variant4.phpt index 39e28892a4..c8379d34a0 100644 --- a/ext/intl/tests/timezone_getDisplayName_variant4.phpt +++ b/ext/intl/tests/timezone_getDisplayName_variant4.phpt @@ -32,4 +32,4 @@ string(5) "+0000" string(3) "GMT" string(3) "GMT" string(13) "Portugal Time" -==DONE==
+==DONE== diff --git a/ext/mbstring/tests/bug52981.phpt b/ext/mbstring/tests/bug52981.phpt index fe96a56f08..7dce14a7ad 100644 --- a/ext/mbstring/tests/bug52981.phpt +++ b/ext/mbstring/tests/bug52981.phpt @@ -1,23 +1,23 @@ ---TEST--
-Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-function test($str)
-{
- $upper = mb_strtoupper($str, 'UTF-8');
- $len = strlen($upper);
- for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
- echo "\n";
-}
-
-// OK
-test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)
-// not OK
-test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005)
-test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009)
---EXPECTF--
-f0 90 90 90
-e2 b0 80
-d4 a4
+--TEST-- +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 diff --git a/ext/mbstring/tests/bug75944.phpt b/ext/mbstring/tests/bug75944.phpt index 81788d7196..cb66d4e230 100644 --- a/ext/mbstring/tests/bug75944.phpt +++ b/ext/mbstring/tests/bug75944.phpt @@ -1,13 +1,13 @@ ---TEST--
-Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?'
-var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?'
-?>
---EXPECT--
-string(12) "Windows-1251"
-string(12) "Windows-1251"
-
+--TEST-- +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" + diff --git a/ext/mcrypt/tests/bug55169.phpt b/ext/mcrypt/tests/bug55169.phpt index 25d5febe06..dcd6ee40e1 100644 --- a/ext/mcrypt/tests/bug55169.phpt +++ b/ext/mcrypt/tests/bug55169.phpt @@ -1,58 +1,58 @@ ---TEST--
-mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
---CREDIT--
-Ryan Biesemeyer <ryan@yaauie.com>
---SKIPIF--
-<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
---FILE--
-<?php
-for( $i=1; $i<=64; $i = $i*2 ){
- echo 'Input: '. $i . PHP_EOL;
- $random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
- echo ' Length: ' . strlen( $random ) . PHP_EOL;
- echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
- echo PHP_EOL;
-}
-?>
---EXPECTF--
-Input: 1
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 1
- Hex: %x
-
-Input: 2
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 2
- Hex: %x
-
-Input: 4
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 4
- Hex: %x
-
-Input: 8
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 8
- Hex: %x
-
-Input: 16
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 16
- Hex: %x
-
-Input: 32
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 32
- Hex: %x
-
-Input: 64
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 64
- Hex: %x
+--TEST-- +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 diff --git a/ext/mysqli/tests/bug53503.phpt b/ext/mysqli/tests/bug53503.phpt index 339fce7a8e..a34b7a3416 100644 --- a/ext/mysqli/tests/bug53503.phpt +++ b/ext/mysqli/tests/bug53503.phpt @@ -1,66 +1,66 @@ ---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--
+--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 diff --git a/ext/mysqli/tests/bug55653.phpt b/ext/mysqli/tests/bug55653.phpt index f9cd297eba..1caff1a27a 100644 --- a/ext/mysqli/tests/bug55653.phpt +++ b/ext/mysqli/tests/bug55653.phpt @@ -1,36 +1,36 @@ ---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--
+--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 diff --git a/ext/mysqli/tests/bug55859.phpt b/ext/mysqli/tests/bug55859.phpt index ba6e9902b3..04467bce24 100644 --- a/ext/mysqli/tests/bug55859.phpt +++ b/ext/mysqli/tests/bug55859.phpt @@ -1,20 +1,20 @@ ---TEST--
-Bug #55859 mysqli->stat property access gives error
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifconnectfailure.inc');
-?>
---FILE--
-<?php
- require_once("connect.inc");
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
- echo "done!";
-?>
---EXPECT--
-bool(true)
-done!
+--TEST-- +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! diff --git a/ext/mysqli/tests/bug62046.phpt b/ext/mysqli/tests/bug62046.phpt index 31a7328b70..c8ad3c3675 100644 --- a/ext/mysqli/tests/bug62046.phpt +++ b/ext/mysqli/tests/bug62046.phpt @@ -1,40 +1,40 @@ ---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)
+--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 diff --git a/ext/mysqli/tests/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt index 9fb0aa0f03..4d02475570 100644 --- a/ext/mysqli/tests/bug62885.phpt +++ b/ext/mysqli/tests/bug62885.phpt @@ -1,26 +1,26 @@ ---TEST--
-Bug #62885 (mysqli_poll - Segmentation fault)
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once("connect.inc");
-if (!$IS_MYSQLND) {
- die("skip mysqlnd only test");
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL);
-$tablica = array();
-$test1 = mysqli_poll($test2, $test3, $tablica, null);
-
-$test2 = array();
-$test2 = array();
-$test1 = mysqli_poll($test2, $test3, $tablica, null);
-echo "okey";
-?>
---EXPECTF--
-Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
-
-Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
-okey
+--TEST-- +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 diff --git a/ext/pcre/tests/bug69864.phpt b/ext/pcre/tests/bug69864.phpt index cf7ba5b72e..09a00d896f 100644 --- a/ext/pcre/tests/bug69864.phpt +++ b/ext/pcre/tests/bug69864.phpt @@ -1,42 +1,42 @@ ---TEST--
-Bug #69864 (Segfault in preg_replace_callback)
---SKIPIF--
-<?php
-if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-?>
---FILE--
-<?php
-/* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */
-
-const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
-
-var_dump(preg_replace_callback('/a/', function($m) {
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
- preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
- }
- return 'b';
-}, 'aa'));
-var_dump(preg_replace_callback('/a/', function($m) {
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
- preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
- }
- return 'b';
-}, 'aa'));
-var_dump(preg_replace_callback('/a/', function($m) {
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
- preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
- }
- return 'b';
-}, 'aa'));
-var_dump(preg_replace_callback('/a/', function($m) {
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
- preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
- }
- return 'b';
-}, 'aa'));
-?>
---EXPECT--
-string(2) "bb"
-string(2) "bb"
-string(2) "bb"
-string(2) "bb"
+--TEST-- +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" diff --git a/ext/pcre/tests/bug73612.phpt b/ext/pcre/tests/bug73612.phpt index 707e10bce6..210e706bfb 100644 --- a/ext/pcre/tests/bug73612.phpt +++ b/ext/pcre/tests/bug73612.phpt @@ -1,27 +1,27 @@ ---TEST--
-Bug #73612 (preg_*() may leak memory)
---FILE--
-<?php
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_match('/./', 'x', $obj);
-
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_replace('/./', '', 'x', -1, $obj);
-
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_replace_callback('/./', 'count', 'x', -1, $obj);
-
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);
-
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_filter('/./', '', 'x', -1, $obj);
-?>
-===DONE===
---EXPECT--
-===DONE===
+--TEST-- +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=== diff --git a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt index fb7e9a9d0a..4528213f11 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt @@ -1,33 +1,33 @@ ---TEST--
-PDO_MYSQL: Defining a connection charset in the DSN
---SKIPIF--
-<?php
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-MySQLPDOTest::skip();
-?>
---FILE--
-<?php
- require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- /* Connect to mysql to determine the current charset so we can diffinate it */
- $link = MySQLPDOTest::factory();
- $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
-
- /* Make sure that we don't attempt to set the current character set to make this case useful */
- $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
-
- /* Done with the original connection, create a second link to test the character set being defined */
- unset($link);
-
- $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
- $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
-
- if ($charset !== $conn_charset) {
- echo "done!\n";
- } else {
- echo "failed!\n";
- }
-?>
---EXPECTF--
-done!
+--TEST-- +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! diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt index a88769b038..1c8a1eed8f 100755 --- a/ext/pgsql/tests/30nb_async_query_params.phpt +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -1,78 +1,78 @@ ---TEST--
-PostgreSQL non-blocking async query params
---SKIPIF--
-<?php
-include("skipif.inc");
-if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
-?>
---FILE--
-<?php
-
-include('config.inc');
-include('nonblocking.inc');
-
-$db = pg_connect($conn_str);
-
-$version = pg_version($db);
-if ($version['protocol'] < 3) {
- echo "OK";
- exit(0);
-}
-
-$db_socket = pg_socket($db);
-stream_set_blocking($db_socket, false);
-
-$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
-if ($sent === FALSE) {
- echo "pg_send_query_params() error\n";
-} elseif ($sent === 0) {
- nb_flush($db, $db_socket);
-}
-
-nb_consume($db, $db_socket);
-
-if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
-}
-if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
-}
-for ($i=0; $i < $rows; $i++) {
- pg_fetch_array($result, $i, PGSQL_NUM);
-}
-for ($i=0; $i < $rows; $i++) {
- pg_fetch_object($result);
-}
-for ($i=0; $i < $rows; $i++) {
- pg_fetch_row($result, $i);
-}
-for ($i=0; $i < $rows; $i++) {
- pg_fetch_result($result, $i, 0);
-}
-
-pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
-pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
-pg_field_name($result, 0);
-pg_field_num($result, $field_name);
-pg_field_size($result, 0);
-pg_field_type($result, 0);
-pg_field_prtlen($result, 0);
-pg_field_is_null($result, 0);
-
-$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
-
-if ($sent === FALSE) {
- echo "pg_send_query_params() error\n";
-} elseif ($sent === 0) {
- nb_flush($db, $db_socket);
-}
-
-pg_last_oid($result);
-pg_free_result($result);
-
-pg_close($db);
-
-echo "OK";
-?>
---EXPECT--
-OK
+--TEST-- +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 diff --git a/ext/phar/tests/bug53872.phpt b/ext/phar/tests/bug53872.phpt index fd332fdf02..2fc55d9155 100644 --- a/ext/phar/tests/bug53872.phpt +++ b/ext/phar/tests/bug53872.phpt @@ -1,28 +1,28 @@ ---TEST--
-bug#53872 (internal corruption of phar)
---SKIPIF--
-<?php
-if (!extension_loaded("phar")) die("skip");
-if (!extension_loaded("zlib")) die("skip Test needs ext/zlib");
-?>
---INI--
-phar.readonly=0
---FILE--
-<?php
-$p=new Phar('bug53872-phar.phar');
-$p->buildFromDirectory(__DIR__ . "/bug53872/");
-$p->setStub('<?php __HALT_COMPILER();?\>');
-$p->compressFiles(Phar::GZ);
-
-print(file_get_contents('phar://bug53872-phar.phar/first.txt'));
-print(file_get_contents('phar://bug53872-phar.phar/second.txt'));
-print(file_get_contents('phar://bug53872-phar.phar/third.txt'));
-?>
---CLEAN--
-<?php
-unlink("bug53872-phar.phar");
-?>
---EXPECT--
-content of first.txt
-content of third.txt
-
+--TEST-- +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 + diff --git a/ext/phar/tests/phar_gobyebye-win32.phpt b/ext/phar/tests/phar_gobyebye-win32.phpt index 43c8c77823..526a8cbf91 100644 --- a/ext/phar/tests/phar_gobyebye-win32.phpt +++ b/ext/phar/tests/phar_gobyebye-win32.phpt @@ -1,48 +1,48 @@ ---TEST--
-Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
---SKIPIF--
-<?php if (!extension_loaded("phar")) die("skip");
-if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
-?>
---INI--
-phar.readonly=0
---FILE--
-<?php
-Phar::interceptFileFuncs();
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
-$pname = 'phar://' . $fname;
-file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
-file_put_contents($pname . '/foo/hi', '<?php
-include "' . addslashes($fname2) . '";
-readfile("foo/hi");
-fopen("foo/hi", "r");
-echo file_get_contents("foo/hi");
-var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
-opendir("foo/hi");
-?>
-');
-include $pname . '/foo/hi';
-?>
-===DONE===
---CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
---EXPECTF--
-Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-
-Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-
-Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-
-Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-
-Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-
-Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-===DONE===
+--TEST-- +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=== diff --git a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt index 5655d19972..942bea2dc2 100644 --- a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt +++ b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt @@ -1,76 +1,76 @@ ---TEST--
-ReflectionParameter class - canBePassedByValue() method.
---FILE--
-<?php
-
-function aux($fun) {
-
- $func = new ReflectionFunction($fun);
- $parameters = $func->getParameters();
- foreach($parameters as $parameter) {
- echo "Name: ", $parameter->getName(), "\n";
- echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
- echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
- echo "\n";
- }
-
-}
-
-echo "=> array_multisort:\n\n";
-
-aux('array_multisort');
-
-
-echo "=> sort:\n\n";
-
-aux('sort');
-
-echo "=> user function:\n\n";
-
-function ufunc(&$arg1, $arg2) {}
-
-aux('ufunc');
-
-echo "Done.\n";
-
-?>
---EXPECTF--
-=> array_multisort:
-
-Name: arr1
-Is passed by reference: yes
-Can be passed by value: yes
-
-Name: sort_order
-Is passed by reference: yes
-Can be passed by value: yes
-
-Name: sort_flags
-Is passed by reference: yes
-Can be passed by value: yes
-
-Name: arr2
-Is passed by reference: yes
-Can be passed by value: yes
-
-=> sort:
-
-Name: arg
-Is passed by reference: yes
-Can be passed by value: no
-
-Name: sort_flags
-Is passed by reference: no
-Can be passed by value: yes
-
-=> user function:
-
-Name: arg1
-Is passed by reference: yes
-Can be passed by value: no
-
-Name: arg2
-Is passed by reference: no
-Can be passed by value: yes
-
-Done.
+--TEST-- +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. diff --git a/ext/reflection/tests/ReflectionParameter_isDefault.phpt b/ext/reflection/tests/ReflectionParameter_isDefault.phpt index 657077093b..d8b4f0edc0 100644 --- a/ext/reflection/tests/ReflectionParameter_isDefault.phpt +++ b/ext/reflection/tests/ReflectionParameter_isDefault.phpt @@ -1,34 +1,34 @@ ---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==
+--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== diff --git a/ext/session/mod_files.bat b/ext/session/mod_files.bat index 4ec9a49ca2..b6a8babae8 100644 --- a/ext/session/mod_files.bat +++ b/ext/session/mod_files.bat @@ -1,57 +1,57 @@ -@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
+@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 diff --git a/ext/session/tests/bug36459.phpt b/ext/session/tests/bug36459.phpt index 66a4ac1cbc..c1b6456174 100644 --- a/ext/session/tests/bug36459.phpt +++ b/ext/session/tests/bug36459.phpt @@ -1,42 +1,42 @@ ---TEST--
-Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_trans_sid=1
-session.use_cookies=0
-session.use_only_cookies=0
-session.name=sid
---FILE--
-<?php
-error_reporting(E_ALL);
-
-session_start();
-
-# Do not remove \r from this tests, they are essential!
-?>
-<html>
- <head>
- <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
- </head>
- <body>
- <p>See source html code</p>
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2"
- style="font: normal 11pt Times New Roman">incorrect link</a><br />
- <br />
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a>
- </body>
-</html>
---EXPECTF--
-<html>
- <head>
- <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
- </head>
- <body>
- <p>See source html code</p>
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s"
- style="font: normal 11pt Times New Roman">incorrect link</a><br />
- <br />
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a>
- </body>
-</html>
+--TEST-- +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> diff --git a/ext/sockets/tests/bug51958.phpt b/ext/sockets/tests/bug51958.phpt index afccd6ce23..b4d75cec48 100644 --- a/ext/sockets/tests/bug51958.phpt +++ b/ext/sockets/tests/bug51958.phpt @@ -1,22 +1,22 @@ ---TEST--
-Bug #51958: socket_accept() fails on IPv6 server sockets
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-if (!defined('IPPROTO_IPV6')) {
- die('skip IPv6 not available.');
-}
-if (PHP_OS != "WINNT")
- die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
---FILE--
-<?php
-$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
-socket_bind($listenfd, "::1", 13579);
-socket_listen($listenfd);
-socket_set_nonblock($listenfd);
-$connfd = @socket_accept($listenfd);
-echo socket_last_error();
---EXPECT--
-10035
+--TEST-- +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 diff --git a/ext/sockets/tests/mcast_ipv4_recv.phpt b/ext/sockets/tests/mcast_ipv4_recv.phpt index 8c90ae0b17..fc92563e84 100644 --- a/ext/sockets/tests/mcast_ipv4_recv.phpt +++ b/ext/sockets/tests/mcast_ipv4_recv.phpt @@ -1,197 +1,197 @@ ---TEST--
-Multicast support: IPv4 receive options
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
-$br = socket_bind($s, '0.0.0.0', 3000);
-$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
- "group" => '224.0.0.23',
- "interface" => 'lo',
-));
-if ($so === false) {
- die('skip interface \'lo\' is unavailable.');
-}
-if (!defined("MCAST_BLOCK_SOURCE")) {
- die('skip source operations are unavailable');
-}
---FILE--
-<?php
-include __DIR__."/mcast_helpers.php.inc";
-$domain = AF_INET;
-$level = IPPROTO_IP;
-$interface = "lo";
-$mcastaddr = '224.0.0.23';
-$sblock = "127.0.0.1";
-
-echo "creating send socket bound to 127.0.0.1\n";
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
-$br = socket_bind($sends1, '127.0.0.1');
-var_dump($br);
-
-echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n";
-$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
-var_dump($br);
-
-echo "creating receive socket\n";
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
-var_dump($s);
-$br = socket_bind($s, '0.0.0.0', 3000);
-var_dump($br);
-
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
-));
-var_dump($so);
-
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-
-$i = 0;
-checktimeout($s, 500);
-while (($str = socket_read($s, 3000)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
-
-if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
-}
-if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 3) {
- echo "blocking source\n";
- $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
-}
-if ($i == 4) {
- echo "unblocking source\n";
- $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 5) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
-}
-if ($i == 6) {
- echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 7) {
- echo "leaving source group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
-}
-if ($i == 8) {
-/* echo "rjsg\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);*/
- break;
-}
-
-}
---EXPECTF--
-creating send socket bound to 127.0.0.1
-bool(true)
-creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23
-bool(true)
-creating receive socket
-resource(%d) of type (Socket)
-bool(true)
-bool(true)
-int(14)
-1> initial packet
-leaving group
-bool(true)
-int(20)
-int(14)
-2> unicast packet
-re-joining group
-bool(true)
-int(42)
-int(12)
-3> mcast packet
-blocking source
-bool(true)
-int(31)
-int(14)
-4> unicast packet
-unblocking source
-bool(true)
-int(27)
-5> mcast packet from 127.0.0.1
-leaving group
-bool(true)
-int(20)
-int(14)
-6> unicast packet
-joining source group
-bool(true)
-int(27)
-7> mcast packet from 127.0.0.1
-leaving source group
-bool(true)
-int(20)
-int(14)
-8> unicast packet
+--TEST-- +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 diff --git a/ext/sockets/tests/mcast_ipv6_recv.phpt b/ext/sockets/tests/mcast_ipv6_recv.phpt index 61d1e8458f..6ff97b60d5 100644 --- a/ext/sockets/tests/mcast_ipv6_recv.phpt +++ b/ext/sockets/tests/mcast_ipv6_recv.phpt @@ -1,226 +1,226 @@ ---TEST--
-Multicast support: IPv6 receive options
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-if (!defined('IPPROTO_IPV6')) {
- die('skip IPv6 not available.');
-}
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
-if ($s === false) {
- die("skip unable to create socket");
-}
-$br = socket_bind($s, '::', 3000);
-/* On Linux, there is no route ff00::/8 by default on lo, which makes it
- * troublesome to send multicast traffic from lo, which we must since
- * we're dealing with interface-local traffic... */
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
-));
-if ($so === false) {
- die('skip unable to join multicast group on any interface.');
-}
-$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
-if ($r === false) {
- die('skip unable to send multicast packet.');
-}
-
-if (!defined("MCAST_JOIN_SOURCE_GROUP"))
- die('skip source operations are unavailable');
-
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
-));
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
- "source" => '2001::dead:beef',
-));
-if ($so === false) {
- die('skip protocol independent multicast API is unavailable.');
-}
-
---FILE--
-<?php
-include __DIR__."/mcast_helpers.php.inc";
-$domain = AF_INET6;
-$level = IPPROTO_IPV6;
-$interface = 0;
-$mcastaddr = 'ff01::114';
-$sblock = "?";
-
-echo "creating send socket\n";
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-var_dump($sends1);
-
-echo "creating receive socket\n";
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-var_dump($s);
-$br = socket_bind($s, '::0', 3000) or die("err");
-var_dump($br);
-
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
-)) or die("err");
-var_dump($so);
-
-$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-checktimeout($s, 500);
-$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
-var_dump($r, $str, $from);
-$sblock = $from;
-
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-
-$i = 0;
-checktimeout($s, 500);
-while (($str = socket_read($s, 3000)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
-
-if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 3) {
- echo "blocking source\n";
- $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 4) {
- echo "unblocking source\n";
- $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 5) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 6) {
- echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 7) {
- echo "leaving source group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 8) {
- /*echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);*/
- break;
-}
-
-}
---EXPECTF--
-creating send socket
-resource(%d) of type (Socket)
-creating receive socket
-resource(%d) of type (Socket)
-bool(true)
-bool(true)
-int(14)
-int(14)
-string(14) "testing packet"
-string(%d) "%s"
-int(14)
-1> initial packet
-leaving group
-bool(true)
-int(20)
-int(14)
-2> unicast packet
-re-joining group
-bool(true)
-int(12)
-3> mcast packet
-blocking source
-bool(true)
-int(31)
-int(14)
-4> unicast packet
-unblocking source
-bool(true)
-int(12)
-5> mcast packet
-leaving group
-bool(true)
-int(20)
-int(14)
-6> unicast packet
-joining source group
-bool(true)
-int(32)
-7> mcast packet from desired source
-leaving source group
-bool(true)
-int(20)
-int(14)
-8> unicast packet
+--TEST-- +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 diff --git a/ext/sockets/tests/mcast_ipv6_recv_limited.phpt b/ext/sockets/tests/mcast_ipv6_recv_limited.phpt index fda099877d..9fd5459950 100644 --- a/ext/sockets/tests/mcast_ipv6_recv_limited.phpt +++ b/ext/sockets/tests/mcast_ipv6_recv_limited.phpt @@ -1,131 +1,131 @@ ---TEST--
-Multicast support: IPv6 receive options (limited)
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-if (!defined('IPPROTO_IPV6')) {
- die('skip IPv6 not available.');
-}
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
-$br = socket_bind($s, '::', 3000);
-/* On Linux, there is no route ff00::/8 by default on lo, which makes it
- * troublesome to send multicast traffic from lo, which we must since
- * we're dealing with interface-local traffic... */
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
-));
-if ($so === false) {
- die('skip unable to join multicast group on any interface.');
-}
-$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
-if ($r === false) {
- die('skip unable to send multicast packet.');
-}
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
-));
-if (defined("MCAST_JOIN_SOURCE_GROUP")) {
- $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
- "source" => '2001::dead:beef',
- ));
- if ($so !== false) {
- die('skip protocol independent multicast API is available.');
- }
-}
-
---FILE--
-<?php
-include __DIR__."/mcast_helpers.php.inc";
-$domain = AF_INET6;
-$level = IPPROTO_IPV6;
-$interface = 0;
-$mcastaddr = 'ff01::114';
-$sblock = "?";
-
-echo "creating send socket\n";
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-var_dump($sends1);
-
-echo "creating receive socket\n";
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-var_dump($s);
-$br = socket_bind($s, '::0', 3000) or die("err");
-var_dump($br);
-
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
-)) or die("err");
-var_dump($so);
-
-$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-checktimeout($s, 500);
-$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
-var_dump($r, $str, $from);
-$sblock = $from;
-
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-
-$i = 0;
-checktimeout($s, 500);
-while (($str = socket_read($s, 3000, 500)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
-
-if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 3) {
- break;
-}
-
-}
---EXPECTF--
-creating send socket
-resource(%d) of type (Socket)
-creating receive socket
-resource(%d) of type (Socket)
-bool(true)
-bool(true)
-int(14)
-int(14)
-string(14) "testing packet"
-string(%d) "%s"
-int(14)
-1> initial packet
-leaving group
-bool(true)
-int(20)
-int(14)
-2> unicast packet
-re-joining group
-bool(true)
-int(12)
-3> mcast packet
+--TEST-- +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 diff --git a/ext/sockets/tests/mcast_ipv6_send.phpt b/ext/sockets/tests/mcast_ipv6_send.phpt index f75bb09903..a9d6293fc9 100644 --- a/ext/sockets/tests/mcast_ipv6_send.phpt +++ b/ext/sockets/tests/mcast_ipv6_send.phpt @@ -1,70 +1,70 @@ ---TEST--
-Multicast support: IPv6 send options
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-if (!defined('IPPROTO_IPV6')) {
- die('skip IPv6 not available.');
-}
-$level = IPPROTO_IPV6;
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket");
-if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) {
- die("skip interface 1 either doesn't exist or has no ipv6 address");
-}
---FILE--
-<?php
-$domain = AF_INET6;
-$level = IPPROTO_IPV6;
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-
-echo "Setting IPV6_MULTICAST_TTL\n";
-$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);
-var_dump($r);
-echo "\n";
-
-echo "Setting IPV6_MULTICAST_LOOP\n";
-$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
-var_dump($r);
-$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
-var_dump($r);
-echo "\n";
-
-echo "Setting IPV6_MULTICAST_IF\n";
-echo "interface 0:\n";
-$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
-var_dump($r);
-echo "interface 1:\n";
-$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
-var_dump($r);
-echo "\n";
-
---EXPECT--
-Setting IPV6_MULTICAST_TTL
-bool(true)
-int(9)
-
-Setting IPV6_MULTICAST_LOOP
-bool(true)
-int(0)
-bool(true)
-int(1)
-
-Setting IPV6_MULTICAST_IF
-interface 0:
-bool(true)
-int(0)
-interface 1:
-bool(true)
-int(1)
+--TEST-- +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) diff --git a/ext/spl/tests/DirectoryIterator_getInode_basic.phpt b/ext/spl/tests/DirectoryIterator_getInode_basic.phpt index 4fd7e8da35..a6b128a222 100644 --- a/ext/spl/tests/DirectoryIterator_getInode_basic.phpt +++ b/ext/spl/tests/DirectoryIterator_getInode_basic.phpt @@ -1,19 +1,19 @@ ---TEST--
-SPL: Spl Directory Iterator test getInode
---CREDITS--
+--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
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#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'); -?>
---EXPECTF--
+?> +--EXPECTF-- string(%d) "%d" diff --git a/ext/spl/tests/DirectoryIterator_getInode_error.phpt b/ext/spl/tests/DirectoryIterator_getInode_error.phpt index ba9014c690..570bb21fda 100644 --- a/ext/spl/tests/DirectoryIterator_getInode_error.phpt +++ b/ext/spl/tests/DirectoryIterator_getInode_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getInode
---CREDITS--
+--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
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#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()); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for %s in %s Stack trace: diff --git a/ext/spl/tests/SplFileInfo_getGroup_error.phpt b/ext/spl/tests/SplFileInfo_getGroup_error.phpt index acfa6b99c5..79492e0e9c 100644 --- a/ext/spl/tests/SplFileInfo_getGroup_error.phpt +++ b/ext/spl/tests/SplFileInfo_getGroup_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getGroup
---CREDITS--
+--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
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#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()); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getGroup(): stat failed for not_existing in %s Stack trace: diff --git a/ext/spl/tests/SplFileInfo_getInode_basic.phpt b/ext/spl/tests/SplFileInfo_getInode_basic.phpt index 380b865cd2..9ee2c6ee51 100644 --- a/ext/spl/tests/SplFileInfo_getInode_basic.phpt +++ b/ext/spl/tests/SplFileInfo_getInode_basic.phpt @@ -1,19 +1,19 @@ ---TEST--
-SPL: Spl File Info test getInode
---CREDITS--
+--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
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#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'); -?>
---EXPECTF--
+?> +--EXPECTF-- bool(true) diff --git a/ext/spl/tests/SplFileInfo_getInode_error.phpt b/ext/spl/tests/SplFileInfo_getInode_error.phpt index 31b5382336..c2b9803735 100644 --- a/ext/spl/tests/SplFileInfo_getInode_error.phpt +++ b/ext/spl/tests/SplFileInfo_getInode_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getPerms
---CREDITS--
+--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
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#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()); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for not_existing in %s Stack trace: diff --git a/ext/spl/tests/SplFileInfo_getOwner_error.phpt b/ext/spl/tests/SplFileInfo_getOwner_error.phpt index f6b4b29195..073744aa00 100644 --- a/ext/spl/tests/SplFileInfo_getOwner_error.phpt +++ b/ext/spl/tests/SplFileInfo_getOwner_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getOwner
---CREDITS--
+--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
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#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()); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getOwner(): stat failed for not_existing in %s Stack trace: diff --git a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt index 53591f3417..af09907605 100644 --- a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt +++ b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt @@ -1,19 +1,19 @@ ---TEST--
-SPL: Spl File Info test getPerms
---CREDITS--
+--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
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#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'); -?>
---EXPECTF--
+?> +--EXPECTF-- bool(true) diff --git a/ext/spl/tests/SplFileInfo_getPerms_error.phpt b/ext/spl/tests/SplFileInfo_getPerms_error.phpt index 23b48de976..4b70c2635b 100644 --- a/ext/spl/tests/SplFileInfo_getPerms_error.phpt +++ b/ext/spl/tests/SplFileInfo_getPerms_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getPerms
---CREDITS--
+--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
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#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); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getPerms(): stat failed for %s in %s Stack trace: diff --git a/ext/spl/tests/bug73629.phpt b/ext/spl/tests/bug73629.phpt index 5b6587c685..ee0b8a6fba 100644 --- a/ext/spl/tests/bug73629.phpt +++ b/ext/spl/tests/bug73629.phpt @@ -1,20 +1,20 @@ ---TEST--
-Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
---FILE--
-<?php
-$q = new SplQueue();
-try {
- $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
-} catch (Exception $e) {
- echo 'unexpected exception: ' . $e->getMessage() . "\n";
-}
-try {
- $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
-} catch (Exception $e) {
- echo 'expected exception: ' . $e->getMessage() . "\n";
-}
-?>
-===DONE===
---EXPECTF--
-expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
-===DONE===
+--TEST-- +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=== diff --git a/ext/spl/tests/bug74478.phpt b/ext/spl/tests/bug74478.phpt index da63984d5c..c384648466 100644 --- a/ext/spl/tests/bug74478.phpt +++ b/ext/spl/tests/bug74478.phpt @@ -1,62 +1,62 @@ ---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)
+--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 diff --git a/ext/spl/tests/iterator_069.phpt b/ext/spl/tests/iterator_069.phpt index e9b3177ed6..1ee44785b3 100644 --- a/ext/spl/tests/iterator_069.phpt +++ b/ext/spl/tests/iterator_069.phpt @@ -1,17 +1,17 @@ ---TEST--
-SPL: RecursiveIteratorIterator cannot be used with foreach by reference
---FILE--
-<?php
-
-$arr = array(array(1,2));
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-$recItIt = new RecursiveIteratorIterator($recArrIt);
-
-foreach ($recItIt as &$val) echo "$val\n";
-
-?>
---EXPECTF--
-Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
+--TEST-- +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 diff --git a/ext/spl/tests/iterator_070.phpt b/ext/spl/tests/iterator_070.phpt index c45f08ec45..bbb518e074 100644 --- a/ext/spl/tests/iterator_070.phpt +++ b/ext/spl/tests/iterator_070.phpt @@ -1,20 +1,20 @@ ---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
+--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 diff --git a/ext/spl/tests/iterator_071.phpt b/ext/spl/tests/iterator_071.phpt index 21ec7980ad..8370906abb 100644 --- a/ext/spl/tests/iterator_071.phpt +++ b/ext/spl/tests/iterator_071.phpt @@ -1,32 +1,32 @@ ---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
+--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 diff --git a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt index c9e21b260e..7ed3b6eb34 100644 --- a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt @@ -1,36 +1,36 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
---FILE--
-<?php
-
-$arr = array(array(1,2),2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function beginchildren() {
- throw new Exception;
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
-
-var_dump($recItIt->next());
-
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
-
-var_dump($recItIt2->next());
-
-?>
---EXPECTF--
-NULL
-
-Fatal error: Uncaught Exception in %s
-Stack trace:
-#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
-#1 %s: RecursiveIteratorIterator->next()
-#2 {main}
- thrown in %s on line %d
+--TEST-- +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 diff --git a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt index cbf8136ab6..0e3c1c1439 100644 --- a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt @@ -1,36 +1,36 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
---FILE--
-<?php
-
-$arr = array(1,2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function callHasChildren() {
- throw new Exception;
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
-
-var_dump($recItIt->next());
-
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
-
-var_dump($recItIt2->next());
-
-?>
---EXPECTF--
-NULL
-
-Fatal error: Uncaught Exception in %s
-Stack trace:
-#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
-#1 %s: RecursiveIteratorIterator->next()
-#2 {main}
- thrown in %s on line %d
+--TEST-- +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 diff --git a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt index 82d55cf0ce..32617bf108 100644 --- a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt @@ -1,42 +1,42 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
---FILE--
-<?php
-
-$arr = array(array(1,2));
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function endchildren() {
- throw new Exception;
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
-
-foreach ($recItIt as $val) echo "$val\n";
-
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
-
-echo "===NEXT LOOP===\n";
-
-foreach ($recItIt2 as $val) echo "$val\n";
-
-?>
---EXPECTF--
-1
-2
-===NEXT LOOP===
-1
-2
-
-Fatal error: Uncaught Exception in %s
-Stack trace:
-#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
-#1 %s: RecursiveIteratorIterator->next()
-#2 {main}
- thrown in %s on line %d
+--TEST-- +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 diff --git a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt index bb020fdff0..a2c0d2ea1b 100644 --- a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt @@ -1,36 +1,36 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
---FILE--
-<?php
-
-$arr = array(1,2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function nextelement() {
- throw new Exception;
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
-
-var_dump($recItIt->next());
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
-
-var_dump($recItIt->next());
-
-?>
---EXPECTF--
-NULL
-
-Fatal error: Uncaught Exception in %s
-Stack trace:
-#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
-#1 %s: RecursiveIteratorIterator->next()
-#2 {main}
- thrown in %s on line %d
+--TEST-- +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 diff --git a/ext/sqlite3/tests/bug73333.phpt b/ext/sqlite3/tests/bug73333.phpt index 7315751810..8634b67f76 100644 --- a/ext/sqlite3/tests/bug73333.phpt +++ b/ext/sqlite3/tests/bug73333.phpt @@ -1,26 +1,26 @@ ---TEST--
-Bug #73333 (2147483647 is fetched as string)
---SKIPIF--
-<?php
-if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
-?>
---FILE--
-<?php
-if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
-
-$db = new SQLite3(':memory:');
-$db->exec('CREATE TABLE foo (bar INT)');
-foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
- $db->exec("INSERT INTO foo VALUES ($value)");
-}
-
-$res = $db->query('SELECT bar FROM foo');
-while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
- echo gettype($row[0]), PHP_EOL;
-}
-?>
-===DONE===
---EXPECT--
-integer
-integer
-===DONE===
+--TEST-- +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=== diff --git a/ext/standard/tests/file/bug43353-win32.phpt b/ext/standard/tests/file/bug43353-win32.phpt index 2faabb92c0..76605d97a8 100644 --- a/ext/standard/tests/file/bug43353-win32.phpt +++ b/ext/standard/tests/file/bug43353-win32.phpt @@ -1,25 +1,25 @@ ---TEST--
-Bug #43353 wrong detection of 'data' wrapper
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != "WIN")
- die("skip Run only on Windows");
-?>
---INI--
-allow_url_fopen=1
---FILE--
-<?php
-
-var_dump(is_dir('file:///datafoo:test'));
-var_dump(is_dir('datafoo:test'));
-var_dump(file_get_contents('data:text/plain,foo'));
-var_dump(file_get_contents('datafoo:text/plain,foo'));
-
-?>
---EXPECTF--
-bool(false)
-bool(false)
-string(3) "foo"
-
-Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
-bool(false)
+--TEST-- +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) diff --git a/ext/standard/tests/file/bug49047.phpt b/ext/standard/tests/file/bug49047.phpt index 1ccc94e287..d0805a16fd 100644 --- a/ext/standard/tests/file/bug49047.phpt +++ b/ext/standard/tests/file/bug49047.phpt @@ -1,17 +1,17 @@ ---TEST--
-Test fopen() function : variation: interesting paths, no use include path
---FILE--
-<?php
-// fopen with interesting windows paths.
-$testdir = __DIR__ . '/bug47177.tmpdir';
-mkdir($testdir);
-$t = time() - 3600;
-touch($testdir, $t);
-clearstatcache();
-$t2 = filemtime($testdir);
-if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
-rmdir($testdir);
-echo "Ok.";
-?>
---EXPECTF--
-Ok.
+--TEST-- +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. diff --git a/ext/standard/tests/file/bug53241.phpt b/ext/standard/tests/file/bug53241.phpt index 685bf14620..7ccf2be109 100644 --- a/ext/standard/tests/file/bug53241.phpt +++ b/ext/standard/tests/file/bug53241.phpt @@ -1,23 +1,23 @@ ---TEST--
-Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
---SKIPIF--
-<?php
-/* unfortunately no standard function does a cast to FILE*, so we need
- * curl to test this */
-if (!extension_loaded("curl")) exit("skip curl extension not loaded");
---FILE--
-<?php
-$fn = __DIR__ . "/test.tmp";
-@unlink($fn);
-$fh = fopen($fn, 'xb');
-$ch = curl_init('http://www.yahoo.com/');
-var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
-echo "Done.\n";
---CLEAN--
-<?php
-$fn = __DIR__ . "/test.tmp";
-@unlink($fn);
-?>
---EXPECT--
-bool(true)
-Done.
+--TEST-- +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. diff --git a/ext/standard/tests/file/bug55124.phpt b/ext/standard/tests/file/bug55124.phpt index 1915b7f209..7938196dbc 100644 --- a/ext/standard/tests/file/bug55124.phpt +++ b/ext/standard/tests/file/bug55124.phpt @@ -1,18 +1,18 @@ ---TEST--
-Bug #55124 (recursive mkdir fails with current (dot) directory in path)
---FILE--
-<?php
-$old_dir_path = getcwd();
-chdir(__DIR__);
-mkdir('a/./b', 0755, true);
-if (is_dir('a/b')) {
- rmdir('a/b');
-}
-if (is_dir('./a')) {
- rmdir('a');
-}
-chdir($old_dir_path);
-echo "OK";
-?>
---EXPECT--
-OK
+--TEST-- +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 diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt index 8915bb833c..51dbac9c1e 100644 --- a/ext/standard/tests/file/bug60120.phpt +++ b/ext/standard/tests/file/bug60120.phpt @@ -1,74 +1,74 @@ ---TEST--
-Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048)
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip only for Windows');
-}
-$php = getenv('TEST_PHP_EXECUTABLE');
-if (!$php) {
- die("No php executable defined\n");
-}
-?>
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-$php = getenv('TEST_PHP_EXECUTABLE');
-if (!$php) {
- die("No php executable defined\n");
-}
-$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
-$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
-$stdin = str_repeat('*', 1024 * 16) . '!';
-$stdin = str_repeat('*', 2049 );
-
-$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
-$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
-
-foreach ($pipes as $pipe) {
- stream_set_blocking($pipe, false);
-}
-$writePipes = array($pipes[0]);
-$stdinLen = strlen($stdin);
-$stdinOffset = 0;
-
-unset($pipes[0]);
-
-while ($pipes || $writePipes) {
- $r = $pipes;
- $w = $writePipes;
- $e = null;
- $n = stream_select($r, $w, $e, 60);
-
- if (false === $n) {
- break;
- } elseif ($n === 0) {
- proc_terminate($process);
-
- }
- if ($w) {
- $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
- if (false !== $written) {
- $stdinOffset += $written;
- }
- if ($stdinOffset >= $stdinLen) {
- fclose($writePipes[0]);
- $writePipes = null;
- }
- }
-
- foreach ($r as $pipe) {
- $type = array_search($pipe, $pipes);
- $data = fread($pipe, 8192);
- if (false === $data || feof($pipe)) {
- fclose($pipe);
- unset($pipes[$type]);
- }
- }
-}
-echo "OK.";
-?>
---EXPECT--
-OK.
+--TEST-- +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. diff --git a/ext/standard/tests/file/rename_variation8-win32.phpt b/ext/standard/tests/file/rename_variation8-win32.phpt index 1d25a12e04..7be25949f6 100644 --- a/ext/standard/tests/file/rename_variation8-win32.phpt +++ b/ext/standard/tests/file/rename_variation8-win32.phpt @@ -1,70 +1,70 @@ ---TEST--
-Test rename() function: variation
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
-?>
---FILE--
-<?php
-/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
- Description: Renames a file or directory
-*/
-
-echo "\n*** Testing rename() on non-existing file ***\n";
-$file_path = dirname(__FILE__);
-
-// try renaming a non existing file
-$src_name = $file_path."/non_existent_file.tmp";
-$dest_name = $file_path."/rename_variation8_new.tmp";
-var_dump( rename($src_name, $dest_name) );
-
-// ensure that $dest_name didn't get created
-var_dump( file_exists($src_name) ); // expecting false
-var_dump( file_exists($dest_name) ); // expecting false
-
-// rename a existing dir to new name
-echo "\n*** Testing rename() on existing directory ***\n";
-$dir_name = $file_path."/rename_basic_dir";
-mkdir($dir_name);
-$new_dir_name = $file_path."/rename_basic_dir1";
-var_dump( rename($dir_name, $new_dir_name) );
-//ensure that $new_dir_name got created
-var_dump( file_exists($dir_name) ); // expecting false
-var_dump( file_exists($new_dir_name) ); // expecting true
-
-// try to rename an non_existing dir
-echo "\n*** Testing rename() on non-existing directory ***\n";
-$non_existent_dir_name = $file_path."/non_existent_dir";
-$new_dir_name = "$file_path/rename_basic_dir2";
-var_dump( rename($non_existent_dir_name, $new_dir_name) );
-// ensure that $new_dir_name didn't get created
-var_dump( file_exists($non_existent_dir_name) ); // expecting flase
-var_dump( file_exists($new_dir_name) ); // expecting false
-
-echo "Done\n";
-?>
---CLEAN--
-<?php
-rmdir(dirname(__FILE__)."/rename_basic_dir1");
-?>
---EXPECTF--
-*** Testing rename() on non-existing file ***
-
-Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d
-bool(false)
-bool(false)
-bool(false)
-
-*** Testing rename() on existing directory ***
-bool(true)
-bool(false)
-bool(true)
-
-*** Testing rename() on non-existing directory ***
-
-Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d
-bool(false)
-bool(false)
-bool(false)
-Done
-
+--TEST-- +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 + diff --git a/ext/standard/tests/file/stream_enclosed.phpt b/ext/standard/tests/file/stream_enclosed.phpt index 9520ecce74..f487ed0744 100644 --- a/ext/standard/tests/file/stream_enclosed.phpt +++ b/ext/standard/tests/file/stream_enclosed.phpt @@ -1,20 +1,20 @@ ---TEST--
-Unexposed/leaked stream encloses another stream
---SKIPIF--
-<?php
-if (!function_exists('leak_variable')) die("skip only debug builds");
---FILE--
-<?php
-$s = fopen('php://temp/maxmemory=1024','wb+');
-
-$t = fopen('php://temp/maxmemory=1024','wb+');
-
-/* force conversion of inner stream to STDIO. */
-$i = 0;
-while ($i++ < 5000) {
- fwrite($t, str_repeat('a',1024));
-}
-
-leak_variable($s, true);
-leak_variable($t, true);
---EXPECT--
+--TEST-- +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-- diff --git a/ext/standard/tests/file/windows_links/bug48746.phpt b/ext/standard/tests/file/windows_links/bug48746.phpt index 5978e7f7f1..671c347a61 100644 --- a/ext/standard/tests/file/windows_links/bug48746.phpt +++ b/ext/standard/tests/file/windows_links/bug48746.phpt @@ -1,58 +1,58 @@ ---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$cmd = "mklink /?";
-$ret = @exec($cmd, $output, $return_val);
-if (count($output) == 0) {
- die("mklink.exe not found in PATH");
-}
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-mkdir($dirname, 0700, true);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-var_dump(file_exists("directory"));
-var_dump(file_exists("mklink_junction"));
-var_dump(file_exists("mounted_volume"));
-var_dump(file_exists("$fullpath"));
-var_dump(is_dir("mklink_junction"));
-var_dump(is_dir("$fullpath"));
-var_dump(is_readable("mklink_junction"));
-var_dump(is_writeable("$fullpath"));
-chdir($old_dir);
-
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
+--TEST-- +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) diff --git a/ext/standard/tests/file/windows_links/bug48746_1.phpt b/ext/standard/tests/file/windows_links/bug48746_1.phpt index a4277a47a1..56764bcf5f 100644 --- a/ext/standard/tests/file/windows_links/bug48746_1.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_1.phpt @@ -1,59 +1,59 @@ ---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$cmd = "mklink /?";
-$ret = @exec($cmd, $output, $return_val);
-if (count($output) == 0) {
- die("mklink.exe not found in PATH");
-}
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-include_once "mklink_junction\\a.php";
-file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
-require "$fullpath\\mnt\\test\\directory\\b.php";
-file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "<?php echo \"I am included.\n\" ?>");
-require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php";
-var_dump(is_file("mklink_junction\\a.php"));
-var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php"));
-var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php"));
-unlink("$fullpath\\mnt\\test\\directory\\b.php");
-unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php");
-unlink("mklink_junction\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-I am included.
-I am included.
-I am included.
-bool(true)
-bool(true)
-bool(true)
+--TEST-- +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) diff --git a/ext/standard/tests/file/windows_links/bug48746_2.phpt b/ext/standard/tests/file/windows_links/bug48746_2.phpt index 509610f8a4..9f2ff850b6 100644 --- a/ext/standard/tests/file/windows_links/bug48746_2.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_2.phpt @@ -1,69 +1,69 @@ ---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
-if (strpos($ret, 'privilege')) {
- die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
-}
-unlink('bug48746_tmp.lnk');
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
-print_r(scandir("mklink_junction"));
-print_r(scandir("$fullpath\\mnt\\test\\directory"));
-print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));
-unlink("$fullpath\\mnt\\test\\directory\\b.php");
-unlink("mklink_junction\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
+--TEST-- +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 +) diff --git a/ext/standard/tests/file/windows_links/bug48746_3.phpt b/ext/standard/tests/file/windows_links/bug48746_3.phpt index 98e81787b8..83bdea3a8c 100644 --- a/ext/standard/tests/file/windows_links/bug48746_3.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_3.phpt @@ -1,50 +1,50 @@ ---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec(get_junction().' /? 2>&1', $out);
-if (strpos($out[0], 'recognized')) {
- die('skip. junction.exe not found in PATH.');
-}
-
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-exec(get_junction()." junction directory", $output, $ret_val);
-file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
-include "junction/a.php";
-require_once "junction\\b.php";
-print_r(scandir("junction"));
-unlink("junction\\a.php");
-unlink("junction\\b.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\junction");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-I am included.
-I am included.
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
+--TEST-- +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 +) diff --git a/ext/standard/tests/file/windows_links/bug73962.phpt b/ext/standard/tests/file/windows_links/bug73962.phpt index 6d578386e6..9be48c7eeb 100644 --- a/ext/standard/tests/file/windows_links/bug73962.phpt +++ b/ext/standard/tests/file/windows_links/bug73962.phpt @@ -1,77 +1,77 @@ ---TEST--
-Bug #73962 bug with symlink related to cyrillic directory
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
-if (strpos($ret, 'privilege')) {
- die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
-}
-unlink('bug48746_tmp.lnk');
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = '"' . __DIR__ . "\\mnt\\test\\новая папка" . '"';
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /d mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /d mklink_symlink \"новая папка\"", $output, $ret_val);
-file_put_contents("mklink_symlink\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("$fullpath\\mnt\\test\\новая папка\\b.php", "<?php echo \"I am included.\n\" ?>");
-var_dump(scandir("mklink_symlink"));
-var_dump(scandir("$fullpath\\mnt\\test\\новая папка"));
-var_dump(scandir("$fullpath\\mnt\\test\\mklink_symlink"));
-var_dump(is_readable("$fullpath\\mnt\\test\\mklink_symlink\b.php"));
-unlink("$fullpath\\mnt\\test\\новая папка\\b.php");
-unlink("mklink_symlink\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\новая папка");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_symlink");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-bool(true)
-
+--TEST-- +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) + diff --git a/ext/standard/tests/general_functions/bug50690.phpt b/ext/standard/tests/general_functions/bug50690.phpt index 4d9f0dc5ee..54198a1337 100644 --- a/ext/standard/tests/general_functions/bug50690.phpt +++ b/ext/standard/tests/general_functions/bug50690.phpt @@ -1,14 +1,14 @@ ---TEST--
-Bug #23650 (putenv() does not assign values when the value is one character)
---FILE--
-<?php
-putenv("foo=ab");
-putenv("bar=c");
-var_dump(getenv("foo"));
-var_dump(getenv("bar"));
-var_dump(getenv("thisvardoesnotexist"));
-?>
---EXPECT--
-string(2) "ab"
-string(1) "c"
-bool(false)
+--TEST-- +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) diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt index 9e2e66c94c..544887129f 100644 --- a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt +++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt @@ -1,39 +1,39 @@ ---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
+--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 diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt index 4a8eceb24b..52b2136f5b 100644 --- a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt +++ b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt @@ -1,23 +1,23 @@ ---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
-}
+--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 diff --git a/ext/standard/tests/general_functions/uniqid_error.phpt b/ext/standard/tests/general_functions/uniqid_error.phpt index 96084313c7..8f7f22d7d3 100644 --- a/ext/standard/tests/general_functions/uniqid_error.phpt +++ b/ext/standard/tests/general_functions/uniqid_error.phpt @@ -1,46 +1,46 @@ ---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
+--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 diff --git a/ext/standard/tests/mail/bug73203.phpt b/ext/standard/tests/mail/bug73203.phpt index 6b3bf6618c..79615f31b5 100644 --- a/ext/standard/tests/mail/bug73203.phpt +++ b/ext/standard/tests/mail/bug73203.phpt @@ -1,24 +1,24 @@ ---TEST--
-Bug #73203 (passing additional_parameters causes mail to fail)
---DESCRIPTION--
-We're not really interested in testing mail() here, but it is currently the
-only function besides mb_send_mail() which allows to call php_escape_shell_cmd()
-with an empty string. Therefore we don't check the resulting email, but only
-verify that the call succeeds.
---INI--
-sendmail_path=cat >/dev/null
-mail.add_x_header = Off
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows');
-?>
---FILE--
-<?php
-var_dump(
- mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '')
-);
-?>
-===DONE===
---EXPECT--
-bool(true)
-===DONE===
+--TEST-- +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=== diff --git a/ext/standard/tests/network/gethostbyname_basic003.phpt b/ext/standard/tests/network/gethostbyname_basic003.phpt index 711490c413..2cb3d8d229 100644 --- a/ext/standard/tests/network/gethostbyname_basic003.phpt +++ b/ext/standard/tests/network/gethostbyname_basic003.phpt @@ -1,18 +1,18 @@ ---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
+--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 diff --git a/ext/standard/tests/network/gethostbynamel_basic1.phpt b/ext/standard/tests/network/gethostbynamel_basic1.phpt index 5ce7c4251a..9d1580c826 100644 --- a/ext/standard/tests/network/gethostbynamel_basic1.phpt +++ b/ext/standard/tests/network/gethostbynamel_basic1.phpt @@ -1,19 +1,19 @@ ---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
-}
+--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 diff --git a/ext/standard/tests/streams/bug49936_win32.phpt b/ext/standard/tests/streams/bug49936_win32.phpt index 4db4a5044f..594fcae4be 100644 --- a/ext/standard/tests/streams/bug49936_win32.phpt +++ b/ext/standard/tests/streams/bug49936_win32.phpt @@ -1,30 +1,30 @@ ---TEST--
-Bug #49936 (crash with ftp stream in php_stream_context_get_option())
---SKIPIF--
-<?php
-if( substr(PHP_OS, 0, 3) != "WIN" )
- die("skip. Do run on Windows only");
-?>
---INI--
-default_socket_timeout=2
---FILE--
-<?php
-
-$dir = 'ftp://your:self@localhost/';
-
-var_dump(opendir($dir));
-var_dump(opendir($dir));
-
-?>
---EXPECTF--
-Warning: opendir(): connect() failed: %s
- in %s on line %d
-
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
-bool(false)
-
-Warning: opendir(): connect() failed: %s
- in %s on line %d
-
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
-bool(false)
+--TEST-- +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) diff --git a/ext/standard/tests/streams/bug74090.phpt b/ext/standard/tests/streams/bug74090.phpt index 370dd13f1b..c0fc85c5ef 100644 --- a/ext/standard/tests/streams/bug74090.phpt +++ b/ext/standard/tests/streams/bug74090.phpt @@ -1,22 +1,22 @@ ---TEST--
-Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows
---SKIPIF--
-<?php
-if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
-if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); }
-?>
---FILE--
-<?php
-$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");
-$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
-stream_set_blocking($fd, 0);
-stream_socket_sendto($fd,$data);
-sleep(1);
-$ret = stream_get_contents($fd,65565);
-var_dump(strlen($ret) > 0);
-stream_socket_shutdown($fd,STREAM_SHUT_RDWR);
-?>
-==DONE==
---EXPECTF--
-bool(true)
-==DONE==
+--TEST-- +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== diff --git a/ext/standard/tests/strings/bug50052.phpt b/ext/standard/tests/strings/bug50052.phpt index 96d859992e..97a4481ea9 100644 --- a/ext/standard/tests/strings/bug50052.phpt +++ b/ext/standard/tests/strings/bug50052.phpt @@ -1,12 +1,12 @@ ---TEST--
-Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size)
---FILE--
-<?php
-$salt = '$1$f+uslYF01$';
-$password = 'test';
-echo $salt . "\n";
-echo crypt($password,$salt) . "\n";
-?>
---EXPECT--
-$1$f+uslYF01$
-$1$f+uslYF0$orVloNmKSLvOeswusE0bY.
+--TEST-- +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. diff --git a/ext/standard/tests/strings/bug53021.phpt b/ext/standard/tests/strings/bug53021.phpt index 38d904761d..15b3cb07e9 100644 --- a/ext/standard/tests/strings/bug53021.phpt +++ b/ext/standard/tests/strings/bug53021.phpt @@ -1,40 +1,40 @@ ---TEST--
-Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1)
---FILE--
-<?php
-var_dump(unpack("H*",html_entity_decode("é", ENT_QUOTES, "ISO-8859-1")));
-echo "double quotes variations:", "\n";
-echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode("""), "\n";
-echo html_entity_decode("""), "\n";
-
-echo "\nsingle quotes variations:", "\n";
-echo html_entity_decode("'", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("'", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("'", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode("'"), "\n";
---EXPECT--
-array(1) {
- [1]=>
- string(2) "e9"
-}
-double quotes variations:
-"
-"
-"
-"
-"
-"
-"
-"
-
-single quotes variations:
-'
-'
-'
-'
+--TEST-- +Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1) +--FILE-- +<?php +var_dump(unpack("H*",html_entity_decode("é", ENT_QUOTES, "ISO-8859-1"))); +echo "double quotes variations:", "\n"; +echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n"; +echo html_entity_decode("""), "\n"; +echo html_entity_decode("""), "\n"; + +echo "\nsingle quotes variations:", "\n"; +echo html_entity_decode("'", ENT_NOQUOTES, 'UTF-8'), "\n"; +echo html_entity_decode("'", ENT_QUOTES, 'UTF-8'), "\n"; +echo html_entity_decode("'", ENT_COMPAT, 'UTF-8'), "\n"; +echo html_entity_decode("'"), "\n"; +--EXPECT-- +array(1) { + [1]=> + string(2) "e9" +} +double quotes variations: +" +" +" +" +" +" +" +" + +single quotes variations: +' +' +' +' diff --git a/ext/standard/tests/strings/get_html_translation_table_basic1.phpt b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt index 87857d9cbd..83892a381a 100644 --- a/ext/standard/tests/strings/get_html_translation_table_basic1.phpt +++ b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt @@ -1,549 +1,549 @@ ---TEST--
-Test get_html_translation_table() function : basic functionality - with default args
---FILE--
-<?php
-/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
- * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
- * Source code: ext/standard/html.c
-*/
-
-/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
-
-
-echo "*** Testing get_html_translation_table() : basic functionality ***\n";
-
-echo "-- with table = HTML_ENTITIES --\n";
-$table = HTML_ENTITIES;
-$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
-asort($tt);
-var_dump( $tt );
-
-echo "-- with table = HTML_SPECIALCHARS --\n";
-$table = HTML_SPECIALCHARS;
-$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
-asort($tt);
-var_dump( $tt );
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing get_html_translation_table() : basic functionality ***
--- with table = HTML_ENTITIES --
-array(252) {
- ["Æ"]=>
- string(7) "Æ"
- ["Á"]=>
- string(8) "Á"
- ["Â"]=>
- string(7) "Â"
- ["À"]=>
- string(8) "À"
- ["Α"]=>
- string(7) "Α"
- ["Å"]=>
- string(7) "Å"
- ["Ã"]=>
- string(8) "Ã"
- ["Ä"]=>
- string(6) "Ä"
- ["Β"]=>
- string(6) "Β"
- ["Ç"]=>
- string(8) "Ç"
- ["Χ"]=>
- string(5) "Χ"
- ["‡"]=>
- string(8) "‡"
- ["Δ"]=>
- string(7) "Δ"
- ["Ð"]=>
- string(5) "Ð"
- ["É"]=>
- string(8) "É"
- ["Ê"]=>
- string(7) "Ê"
- ["È"]=>
- string(8) "È"
- ["Ε"]=>
- string(9) "Ε"
- ["Η"]=>
- string(5) "Η"
- ["Ë"]=>
- string(6) "Ë"
- ["Γ"]=>
- string(7) "Γ"
- ["Í"]=>
- string(8) "Í"
- ["Î"]=>
- string(7) "Î"
- ["Ì"]=>
- string(8) "Ì"
- ["Ι"]=>
- string(6) "Ι"
- ["Ï"]=>
- string(6) "Ï"
- ["Κ"]=>
- string(7) "Κ"
- ["Λ"]=>
- string(8) "Λ"
- ["Μ"]=>
- string(4) "Μ"
- ["Ñ"]=>
- string(8) "Ñ"
- ["Ν"]=>
- string(4) "Ν"
- ["Œ"]=>
- string(7) "Œ"
- ["Ó"]=>
- string(8) "Ó"
- ["Ô"]=>
- string(7) "Ô"
- ["Ò"]=>
- string(8) "Ò"
- ["Ω"]=>
- string(7) "Ω"
- ["Ο"]=>
- string(9) "Ο"
- ["Ø"]=>
- string(8) "Ø"
- ["Õ"]=>
- string(8) "Õ"
- ["Ö"]=>
- string(6) "Ö"
- ["Φ"]=>
- string(5) "Φ"
- ["Π"]=>
- string(4) "Π"
- ["″"]=>
- string(7) "″"
- ["Ψ"]=>
- string(5) "Ψ"
- ["Ρ"]=>
- string(5) "Ρ"
- ["Š"]=>
- string(8) "Š"
- ["Σ"]=>
- string(7) "Σ"
- ["Þ"]=>
- string(7) "Þ"
- ["Τ"]=>
- string(5) "Τ"
- ["Θ"]=>
- string(7) "Θ"
- ["Ú"]=>
- string(8) "Ú"
- ["Û"]=>
- string(7) "Û"
- ["Ù"]=>
- string(8) "Ù"
- ["Υ"]=>
- string(9) "Υ"
- ["Ü"]=>
- string(6) "Ü"
- ["Ξ"]=>
- string(4) "Ξ"
- ["Ý"]=>
- string(8) "Ý"
- ["Ÿ"]=>
- string(6) "Ÿ"
- ["Ζ"]=>
- string(6) "Ζ"
- ["á"]=>
- string(8) "á"
- ["â"]=>
- string(7) "â"
- ["´"]=>
- string(7) "´"
- ["æ"]=>
- string(7) "æ"
- ["à"]=>
- string(8) "à"
- ["ℵ"]=>
- string(9) "ℵ"
- ["α"]=>
- string(7) "α"
- ["&"]=>
- string(5) "&"
- ["∧"]=>
- string(5) "∧"
- ["∠"]=>
- string(5) "∠"
- ["å"]=>
- string(7) "å"
- ["≈"]=>
- string(7) "≈"
- ["ã"]=>
- string(8) "ã"
- ["ä"]=>
- string(6) "ä"
- ["„"]=>
- string(7) "„"
- ["β"]=>
- string(6) "β"
- ["¦"]=>
- string(8) "¦"
- ["•"]=>
- string(6) "•"
- ["∩"]=>
- string(5) "∩"
- ["ç"]=>
- string(8) "ç"
- ["¸"]=>
- string(7) "¸"
- ["¢"]=>
- string(6) "¢"
- ["χ"]=>
- string(5) "χ"
- ["ˆ"]=>
- string(6) "ˆ"
- ["♣"]=>
- string(7) "♣"
- ["≅"]=>
- string(6) "≅"
- ["©"]=>
- string(6) "©"
- ["↵"]=>
- string(7) "↵"
- ["∪"]=>
- string(5) "∪"
- ["¤"]=>
- string(8) "¤"
- ["⇓"]=>
- string(6) "⇓"
- ["†"]=>
- string(8) "†"
- ["↓"]=>
- string(6) "↓"
- ["°"]=>
- string(5) "°"
- ["δ"]=>
- string(7) "δ"
- ["♦"]=>
- string(7) "♦"
- ["÷"]=>
- string(8) "÷"
- ["é"]=>
- string(8) "é"
- ["ê"]=>
- string(7) "ê"
- ["è"]=>
- string(8) "è"
- ["∅"]=>
- string(7) "∅"
- [" "]=>
- string(6) " "
- [" "]=>
- string(6) " "
- ["ε"]=>
- string(9) "ε"
- ["≡"]=>
- string(7) "≡"
- ["η"]=>
- string(5) "η"
- ["ð"]=>
- string(5) "ð"
- ["ë"]=>
- string(6) "ë"
- ["€"]=>
- string(6) "€"
- ["∃"]=>
- string(7) "∃"
- ["ƒ"]=>
- string(6) "ƒ"
- ["∀"]=>
- string(8) "∀"
- ["½"]=>
- string(8) "½"
- ["¼"]=>
- string(8) "¼"
- ["¾"]=>
- string(8) "¾"
- ["⁄"]=>
- string(7) "⁄"
- ["γ"]=>
- string(7) "γ"
- ["≥"]=>
- string(4) "≥"
- [">"]=>
- string(4) ">"
- ["⇔"]=>
- string(6) "⇔"
- ["↔"]=>
- string(6) "↔"
- ["♥"]=>
- string(8) "♥"
- ["…"]=>
- string(8) "…"
- ["í"]=>
- string(8) "í"
- ["î"]=>
- string(7) "î"
- ["¡"]=>
- string(7) "¡"
- ["ì"]=>
- string(8) "ì"
- ["ℑ"]=>
- string(7) "ℑ"
- ["∞"]=>
- string(7) "∞"
- ["∫"]=>
- string(5) "∫"
- ["ι"]=>
- string(6) "ι"
- ["¿"]=>
- string(8) "¿"
- ["∈"]=>
- string(6) "∈"
- ["ï"]=>
- string(6) "ï"
- ["κ"]=>
- string(7) "κ"
- ["⇐"]=>
- string(6) "⇐"
- ["λ"]=>
- string(8) "λ"
- ["〈"]=>
- string(6) "⟨"
- ["«"]=>
- string(7) "«"
- ["←"]=>
- string(6) "←"
- ["⌈"]=>
- string(7) "⌈"
- ["“"]=>
- string(7) "“"
- ["≤"]=>
- string(4) "≤"
- ["⌊"]=>
- string(8) "⌊"
- ["∗"]=>
- string(8) "∗"
- ["◊"]=>
- string(5) "◊"
- [""]=>
- string(5) "‎"
- ["‹"]=>
- string(8) "‹"
- ["‘"]=>
- string(7) "‘"
- ["<"]=>
- string(4) "<"
- ["¯"]=>
- string(6) "¯"
- ["—"]=>
- string(7) "—"
- ["µ"]=>
- string(7) "µ"
- ["·"]=>
- string(8) "·"
- ["−"]=>
- string(7) "−"
- ["μ"]=>
- string(4) "μ"
- ["∇"]=>
- string(7) "∇"
- [" "]=>
- string(6) " "
- ["–"]=>
- string(7) "–"
- ["≠"]=>
- string(4) "≠"
- ["∋"]=>
- string(4) "∋"
- ["¬"]=>
- string(5) "¬"
- ["∉"]=>
- string(7) "∉"
- ["⊄"]=>
- string(6) "⊄"
- ["ñ"]=>
- string(8) "ñ"
- ["ν"]=>
- string(4) "ν"
- ["ó"]=>
- string(8) "ó"
- ["ô"]=>
- string(7) "ô"
- ["œ"]=>
- string(7) "œ"
- ["ò"]=>
- string(8) "ò"
- ["‾"]=>
- string(7) "‾"
- ["ω"]=>
- string(7) "ω"
- ["ο"]=>
- string(9) "ο"
- ["⊕"]=>
- string(7) "⊕"
- ["∨"]=>
- string(4) "∨"
- ["ª"]=>
- string(6) "ª"
- ["º"]=>
- string(6) "º"
- ["ø"]=>
- string(8) "ø"
- ["õ"]=>
- string(8) "õ"
- ["⊗"]=>
- string(8) "⊗"
- ["ö"]=>
- string(6) "ö"
- ["¶"]=>
- string(6) "¶"
- ["∂"]=>
- string(6) "∂"
- ["‰"]=>
- string(8) "‰"
- ["⊥"]=>
- string(6) "⊥"
- ["φ"]=>
- string(5) "φ"
- ["π"]=>
- string(4) "π"
- ["ϖ"]=>
- string(5) "ϖ"
- ["±"]=>
- string(8) "±"
- ["£"]=>
- string(7) "£"
- ["′"]=>
- string(7) "′"
- ["∏"]=>
- string(6) "∏"
- ["∝"]=>
- string(6) "∝"
- ["ψ"]=>
- string(5) "ψ"
- ["""]=>
- string(6) """
- ["⇒"]=>
- string(6) "⇒"
- ["√"]=>
- string(7) "√"
- ["〉"]=>
- string(6) "⟩"
- ["»"]=>
- string(7) "»"
- ["→"]=>
- string(6) "→"
- ["⌉"]=>
- string(7) "⌉"
- ["”"]=>
- string(7) "”"
- ["ℜ"]=>
- string(6) "ℜ"
- ["®"]=>
- string(5) "®"
- ["⌋"]=>
- string(8) "⌋"
- ["ρ"]=>
- string(5) "ρ"
- [""]=>
- string(5) "‏"
- ["›"]=>
- string(8) "›"
- ["’"]=>
- string(7) "’"
- ["‚"]=>
- string(7) "‚"
- ["š"]=>
- string(8) "š"
- ["⋅"]=>
- string(6) "⋅"
- ["§"]=>
- string(6) "§"
- [""]=>
- string(5) "­"
- ["σ"]=>
- string(7) "σ"
- ["ς"]=>
- string(8) "ς"
- ["∼"]=>
- string(5) "∼"
- ["♠"]=>
- string(8) "♠"
- ["⊂"]=>
- string(5) "⊂"
- ["⊆"]=>
- string(6) "⊆"
- ["∑"]=>
- string(5) "∑"
- ["¹"]=>
- string(6) "¹"
- ["²"]=>
- string(6) "²"
- ["³"]=>
- string(6) "³"
- ["⊃"]=>
- string(5) "⊃"
- ["⊇"]=>
- string(6) "⊇"
- ["ß"]=>
- string(7) "ß"
- ["τ"]=>
- string(5) "τ"
- ["∴"]=>
- string(8) "∴"
- ["θ"]=>
- string(7) "θ"
- ["ϑ"]=>
- string(10) "ϑ"
- [" "]=>
- string(8) " "
- ["þ"]=>
- string(7) "þ"
- ["˜"]=>
- string(7) "˜"
- ["×"]=>
- string(7) "×"
- ["™"]=>
- string(7) "™"
- ["⇑"]=>
- string(6) "⇑"
- ["ú"]=>
- string(8) "ú"
- ["↑"]=>
- string(6) "↑"
- ["û"]=>
- string(7) "û"
- ["ù"]=>
- string(8) "ù"
- ["¨"]=>
- string(5) "¨"
- ["ϒ"]=>
- string(7) "ϒ"
- ["υ"]=>
- string(9) "υ"
- ["ü"]=>
- string(6) "ü"
- ["℘"]=>
- string(8) "℘"
- ["ξ"]=>
- string(4) "ξ"
- ["ý"]=>
- string(8) "ý"
- ["¥"]=>
- string(5) "¥"
- ["ÿ"]=>
- string(6) "ÿ"
- ["ζ"]=>
- string(6) "ζ"
- [""]=>
- string(5) "‍"
- [""]=>
- string(6) "‌"
-}
--- with table = HTML_SPECIALCHARS --
-array(4) {
- ["&"]=>
- string(5) "&"
- [">"]=>
- string(4) ">"
- ["<"]=>
- string(4) "<"
- ["""]=>
- string(6) """
-}
-Done
+--TEST-- +Test get_html_translation_table() function : basic functionality - with default args +--FILE-- +<?php +/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] ) + * Description: Returns the internal translation table used by htmlspecialchars and htmlentities + * Source code: ext/standard/html.c +*/ + +/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */ + + +echo "*** Testing get_html_translation_table() : basic functionality ***\n"; + +echo "-- with table = HTML_ENTITIES --\n"; +$table = HTML_ENTITIES; +$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8"); +asort($tt); +var_dump( $tt ); + +echo "-- with table = HTML_SPECIALCHARS --\n"; +$table = HTML_SPECIALCHARS; +$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8"); +asort($tt); +var_dump( $tt ); + +echo "Done\n"; +?> +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality *** +-- with table = HTML_ENTITIES -- +array(252) { + ["Æ"]=> + string(7) "Æ" + ["Á"]=> + string(8) "Á" + ["Â"]=> + string(7) "Â" + ["À"]=> + string(8) "À" + ["Α"]=> + string(7) "Α" + ["Å"]=> + string(7) "Å" + ["Ã"]=> + string(8) "Ã" + ["Ä"]=> + string(6) "Ä" + ["Β"]=> + string(6) "Β" + ["Ç"]=> + string(8) "Ç" + ["Χ"]=> + string(5) "Χ" + ["‡"]=> + string(8) "‡" + ["Δ"]=> + string(7) "Δ" + ["Ð"]=> + string(5) "Ð" + ["É"]=> + string(8) "É" + ["Ê"]=> + string(7) "Ê" + ["È"]=> + string(8) "È" + ["Ε"]=> + string(9) "Ε" + ["Η"]=> + string(5) "Η" + ["Ë"]=> + string(6) "Ë" + ["Γ"]=> + string(7) "Γ" + ["Í"]=> + string(8) "Í" + ["Î"]=> + string(7) "Î" + ["Ì"]=> + string(8) "Ì" + ["Ι"]=> + string(6) "Ι" + ["Ï"]=> + string(6) "Ï" + ["Κ"]=> + string(7) "Κ" + ["Λ"]=> + string(8) "Λ" + ["Μ"]=> + string(4) "Μ" + ["Ñ"]=> + string(8) "Ñ" + ["Ν"]=> + string(4) "Ν" + ["Œ"]=> + string(7) "Œ" + ["Ó"]=> + string(8) "Ó" + ["Ô"]=> + string(7) "Ô" + ["Ò"]=> + string(8) "Ò" + ["Ω"]=> + string(7) "Ω" + ["Ο"]=> + string(9) "Ο" + ["Ø"]=> + string(8) "Ø" + ["Õ"]=> + string(8) "Õ" + ["Ö"]=> + string(6) "Ö" + ["Φ"]=> + string(5) "Φ" + ["Π"]=> + string(4) "Π" + ["″"]=> + string(7) "″" + ["Ψ"]=> + string(5) "Ψ" + ["Ρ"]=> + string(5) "Ρ" + ["Š"]=> + string(8) "Š" + ["Σ"]=> + string(7) "Σ" + ["Þ"]=> + string(7) "Þ" + ["Τ"]=> + string(5) "Τ" + ["Θ"]=> + string(7) "Θ" + ["Ú"]=> + string(8) "Ú" + ["Û"]=> + string(7) "Û" + ["Ù"]=> + string(8) "Ù" + ["Υ"]=> + string(9) "Υ" + ["Ü"]=> + string(6) "Ü" + ["Ξ"]=> + string(4) "Ξ" + ["Ý"]=> + string(8) "Ý" + ["Ÿ"]=> + string(6) "Ÿ" + ["Ζ"]=> + string(6) "Ζ" + ["á"]=> + string(8) "á" + ["â"]=> + string(7) "â" + ["´"]=> + string(7) "´" + ["æ"]=> + string(7) "æ" + ["à"]=> + string(8) "à" + ["ℵ"]=> + string(9) "ℵ" + ["α"]=> + string(7) "α" + ["&"]=> + string(5) "&" + ["∧"]=> + string(5) "∧" + ["∠"]=> + string(5) "∠" + ["å"]=> + string(7) "å" + ["≈"]=> + string(7) "≈" + ["ã"]=> + string(8) "ã" + ["ä"]=> + string(6) "ä" + ["„"]=> + string(7) "„" + ["β"]=> + string(6) "β" + ["¦"]=> + string(8) "¦" + ["•"]=> + string(6) "•" + ["∩"]=> + string(5) "∩" + ["ç"]=> + string(8) "ç" + ["¸"]=> + string(7) "¸" + ["¢"]=> + string(6) "¢" + ["χ"]=> + string(5) "χ" + ["ˆ"]=> + string(6) "ˆ" + ["♣"]=> + string(7) "♣" + ["≅"]=> + string(6) "≅" + ["©"]=> + string(6) "©" + ["↵"]=> + string(7) "↵" + ["∪"]=> + string(5) "∪" + ["¤"]=> + string(8) "¤" + ["⇓"]=> + string(6) "⇓" + ["†"]=> + string(8) "†" + ["↓"]=> + string(6) "↓" + ["°"]=> + string(5) "°" + ["δ"]=> + string(7) "δ" + ["♦"]=> + string(7) "♦" + ["÷"]=> + string(8) "÷" + ["é"]=> + string(8) "é" + ["ê"]=> + string(7) "ê" + ["è"]=> + string(8) "è" + ["∅"]=> + string(7) "∅" + [" "]=> + string(6) " " + [" "]=> + string(6) " " + ["ε"]=> + string(9) "ε" + ["≡"]=> + string(7) "≡" + ["η"]=> + string(5) "η" + ["ð"]=> + string(5) "ð" + ["ë"]=> + string(6) "ë" + ["€"]=> + string(6) "€" + ["∃"]=> + string(7) "∃" + ["ƒ"]=> + string(6) "ƒ" + ["∀"]=> + string(8) "∀" + ["½"]=> + string(8) "½" + ["¼"]=> + string(8) "¼" + ["¾"]=> + string(8) "¾" + ["⁄"]=> + string(7) "⁄" + ["γ"]=> + string(7) "γ" + ["≥"]=> + string(4) "≥" + [">"]=> + string(4) ">" + ["⇔"]=> + string(6) "⇔" + ["↔"]=> + string(6) "↔" + ["♥"]=> + string(8) "♥" + ["…"]=> + string(8) "…" + ["í"]=> + string(8) "í" + ["î"]=> + string(7) "î" + ["¡"]=> + string(7) "¡" + ["ì"]=> + string(8) "ì" + ["ℑ"]=> + string(7) "ℑ" + ["∞"]=> + string(7) "∞" + ["∫"]=> + string(5) "∫" + ["ι"]=> + string(6) "ι" + ["¿"]=> + string(8) "¿" + ["∈"]=> + string(6) "∈" + ["ï"]=> + string(6) "ï" + ["κ"]=> + string(7) "κ" + ["⇐"]=> + string(6) "⇐" + ["λ"]=> + string(8) "λ" + ["〈"]=> + string(6) "⟨" + ["«"]=> + string(7) "«" + ["←"]=> + string(6) "←" + ["⌈"]=> + string(7) "⌈" + ["“"]=> + string(7) "“" + ["≤"]=> + string(4) "≤" + ["⌊"]=> + string(8) "⌊" + ["∗"]=> + string(8) "∗" + ["◊"]=> + string(5) "◊" + [""]=> + string(5) "‎" + ["‹"]=> + string(8) "‹" + ["‘"]=> + string(7) "‘" + ["<"]=> + string(4) "<" + ["¯"]=> + string(6) "¯" + ["—"]=> + string(7) "—" + ["µ"]=> + string(7) "µ" + ["·"]=> + string(8) "·" + ["−"]=> + string(7) "−" + ["μ"]=> + string(4) "μ" + ["∇"]=> + string(7) "∇" + [" "]=> + string(6) " " + ["–"]=> + string(7) "–" + ["≠"]=> + string(4) "≠" + ["∋"]=> + string(4) "∋" + ["¬"]=> + string(5) "¬" + ["∉"]=> + string(7) "∉" + ["⊄"]=> + string(6) "⊄" + ["ñ"]=> + string(8) "ñ" + ["ν"]=> + string(4) "ν" + ["ó"]=> + string(8) "ó" + ["ô"]=> + string(7) "ô" + ["œ"]=> + string(7) "œ" + ["ò"]=> + string(8) "ò" + ["‾"]=> + string(7) "‾" + ["ω"]=> + string(7) "ω" + ["ο"]=> + string(9) "ο" + ["⊕"]=> + string(7) "⊕" + ["∨"]=> + string(4) "∨" + ["ª"]=> + string(6) "ª" + ["º"]=> + string(6) "º" + ["ø"]=> + string(8) "ø" + ["õ"]=> + string(8) "õ" + ["⊗"]=> + string(8) "⊗" + ["ö"]=> + string(6) "ö" + ["¶"]=> + string(6) "¶" + ["∂"]=> + string(6) "∂" + ["‰"]=> + string(8) "‰" + ["⊥"]=> + string(6) "⊥" + ["φ"]=> + string(5) "φ" + ["π"]=> + string(4) "π" + ["ϖ"]=> + string(5) "ϖ" + ["±"]=> + string(8) "±" + ["£"]=> + string(7) "£" + ["′"]=> + string(7) "′" + ["∏"]=> + string(6) "∏" + ["∝"]=> + string(6) "∝" + ["ψ"]=> + string(5) "ψ" + ["""]=> + string(6) """ + ["⇒"]=> + string(6) "⇒" + ["√"]=> + string(7) "√" + ["〉"]=> + string(6) "⟩" + ["»"]=> + string(7) "»" + ["→"]=> + string(6) "→" + ["⌉"]=> + string(7) "⌉" + ["”"]=> + string(7) "”" + ["ℜ"]=> + string(6) "ℜ" + ["®"]=> + string(5) "®" + ["⌋"]=> + string(8) "⌋" + ["ρ"]=> + string(5) "ρ" + [""]=> + string(5) "‏" + ["›"]=> + string(8) "›" + ["’"]=> + string(7) "’" + ["‚"]=> + string(7) "‚" + ["š"]=> + string(8) "š" + ["⋅"]=> + string(6) "⋅" + ["§"]=> + string(6) "§" + [""]=> + string(5) "­" + ["σ"]=> + string(7) "σ" + ["ς"]=> + string(8) "ς" + ["∼"]=> + string(5) "∼" + ["♠"]=> + string(8) "♠" + ["⊂"]=> + string(5) "⊂" + ["⊆"]=> + string(6) "⊆" + ["∑"]=> + string(5) "∑" + ["¹"]=> + string(6) "¹" + ["²"]=> + string(6) "²" + ["³"]=> + string(6) "³" + ["⊃"]=> + string(5) "⊃" + ["⊇"]=> + string(6) "⊇" + ["ß"]=> + string(7) "ß" + ["τ"]=> + string(5) "τ" + ["∴"]=> + string(8) "∴" + ["θ"]=> + string(7) "θ" + ["ϑ"]=> + string(10) "ϑ" + [" "]=> + string(8) " " + ["þ"]=> + string(7) "þ" + ["˜"]=> + string(7) "˜" + ["×"]=> + string(7) "×" + ["™"]=> + string(7) "™" + ["⇑"]=> + string(6) "⇑" + ["ú"]=> + string(8) "ú" + ["↑"]=> + string(6) "↑" + ["û"]=> + string(7) "û" + ["ù"]=> + string(8) "ù" + ["¨"]=> + string(5) "¨" + ["ϒ"]=> + string(7) "ϒ" + ["υ"]=> + string(9) "υ" + ["ü"]=> + string(6) "ü" + ["℘"]=> + string(8) "℘" + ["ξ"]=> + string(4) "ξ" + ["ý"]=> + string(8) "ý" + ["¥"]=> + string(5) "¥" + ["ÿ"]=> + string(6) "ÿ" + ["ζ"]=> + string(6) "ζ" + [""]=> + string(5) "‍" + [""]=> + string(6) "‌" +} +-- with table = HTML_SPECIALCHARS -- +array(4) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +Done diff --git a/ext/standard/tests/strings/htmlentities-utf-3.phpt b/ext/standard/tests/strings/htmlentities-utf-3.phpt index c28917ba16..82693056ef 100644 --- a/ext/standard/tests/strings/htmlentities-utf-3.phpt +++ b/ext/standard/tests/strings/htmlentities-utf-3.phpt @@ -1,83 +1,83 @@ ---TEST--
-Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences
---FILE--
-<?php
-
-/* conformance to Unicode 5.2, section 3.9, D92 */
-
-$val_ranges = array(
- array(array(0x00, 0x7F)),
- array(array(0xC2, 0xDF), array(0x80, 0xBF)),
- array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),
- array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),
- array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),
-);
-
-function is_valid($seq) {
- global $val_ranges;
- $b = ord($seq[0]);
- foreach ($val_ranges as $l) {
- if ($b >= $l[0][0] && $b <= $l[0][1]) {
- if (count($l) != strlen($seq)) {
- return false;
- }
- for ($n = 1; $n < strlen($seq); $n++) {
- if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
- return false;
- }
- }
- return true;
- }
- }
- return false;
-}
-
-function concordance($s) {
- $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
- $v = is_valid($s);
- return ($vhe === $v);
-}
-
-for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2);
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-
-
-for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2)."\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-
-for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2)."\x80\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\x80\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-echo "Done.\n";
---EXPECT--
-Done.
+--TEST-- +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. diff --git a/ext/standard/tests/strings/md5_basic1.phpt b/ext/standard/tests/strings/md5_basic1.phpt index eda414bc25..a2b2348588 100644 --- a/ext/standard/tests/strings/md5_basic1.phpt +++ b/ext/standard/tests/strings/md5_basic1.phpt @@ -1,17 +1,17 @@ ---TEST--
-Test md5() function : basic functionality
---FILE--
-<?php
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
- * Description: Calculate the md5 hash of a string
- * Source code: ext/standard/md5.c
-*/
-
-echo "*** Testing md5() : basic functionality ***\n";
-var_dump(md5(b"apple"));
-?>
-===DONE===
---EXPECTF--
-*** Testing md5() : basic functionality ***
-string(32) "1f3870be274f6c49b3e31a0c6728957f"
-===DONE===
+--TEST-- +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=== diff --git a/ext/standard/tests/strings/md5_basic2.phpt b/ext/standard/tests/strings/md5_basic2.phpt index 1f89ba82f5..51f711d6c7 100644 --- a/ext/standard/tests/strings/md5_basic2.phpt +++ b/ext/standard/tests/strings/md5_basic2.phpt @@ -1,30 +1,30 @@ ---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
+--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 diff --git a/ext/standard/tests/strings/md5_error.phpt b/ext/standard/tests/strings/md5_error.phpt index 190b09c8e5..dbdbdcb2a5 100644 --- a/ext/standard/tests/strings/md5_error.phpt +++ b/ext/standard/tests/strings/md5_error.phpt @@ -1,35 +1,35 @@ ---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
+--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 diff --git a/ext/standard/tests/strings/soundex_basic.phpt b/ext/standard/tests/strings/soundex_basic.phpt index 65bcb64252..9777473ee9 100644 --- a/ext/standard/tests/strings/soundex_basic.phpt +++ b/ext/standard/tests/strings/soundex_basic.phpt @@ -1,46 +1,46 @@ ---TEST--
-Test soundex() function : basic functionality
---FILE--
-<?php
-/* Prototype : string soundex ( string $str )
- * Description: Calculate the soundex key of a string
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing soundex() : basic functionality ***\n";
-
-var_dump(soundex("Euler"));
-var_dump(soundex("Gauss"));
-var_dump(soundex("Hilbert"));
-var_dump(soundex("Knuth"));
-var_dump(soundex("Lloyd"));
-var_dump(soundex("Lukasiewicz"));
-
-var_dump(soundex("Euler") == soundex("Ellery")); // E460
-var_dump(soundex("Gauss") == soundex("Ghosh")); // G200
-var_dump(soundex("Hilbert") == soundex("Heilbronn")); // H416
-var_dump(soundex("Knuth") == soundex("Kant")); // K530
-var_dump(soundex("Lloyd") == soundex("Ladd")); // L300
-var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222
-
-var_dump(soundex("Lukasiewicz") == soundex("Ghosh"));
-var_dump(soundex("Hilbert") == soundex("Ladd"));
-?>
-===DONE===
---EXPECT--
-*** Testing soundex() : basic functionality ***
-string(4) "E460"
-string(4) "G200"
-string(4) "H416"
-string(4) "K530"
-string(4) "L300"
-string(4) "L222"
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-
-===DONE===
+--TEST-- +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=== diff --git a/ext/standard/tests/strings/soundex_error.phpt b/ext/standard/tests/strings/soundex_error.phpt index a81b9d24fe..20cf2c9d3e 100644 --- a/ext/standard/tests/strings/soundex_error.phpt +++ b/ext/standard/tests/strings/soundex_error.phpt @@ -1,34 +1,34 @@ ---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
-
+--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 diff --git a/ext/standard/tests/strings/str_rot13_basic.phpt b/ext/standard/tests/strings/str_rot13_basic.phpt index 949d725754..321a2bf1b7 100644 --- a/ext/standard/tests/strings/str_rot13_basic.phpt +++ b/ext/standard/tests/strings/str_rot13_basic.phpt @@ -1,55 +1,55 @@ ---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
+--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 diff --git a/ext/standard/tests/strings/str_rot13_error.phpt b/ext/standard/tests/strings/str_rot13_error.phpt index 99a99f29c5..2361c0abb5 100644 --- a/ext/standard/tests/strings/str_rot13_error.phpt +++ b/ext/standard/tests/strings/str_rot13_error.phpt @@ -1,32 +1,32 @@ ---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
+--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 diff --git a/ext/standard/tests/strings/strnatcasecmp_error.phpt b/ext/standard/tests/strings/strnatcasecmp_error.phpt index 45a15daefc..3085e8d8fd 100644 --- a/ext/standard/tests/strings/strnatcasecmp_error.phpt +++ b/ext/standard/tests/strings/strnatcasecmp_error.phpt @@ -1,33 +1,33 @@ ---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
+--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 diff --git a/ext/standard/tests/strings/strnatcmp_basic.phpt b/ext/standard/tests/strings/strnatcmp_basic.phpt index 140bd48d6c..bef01de653 100644 --- a/ext/standard/tests/strings/strnatcmp_basic.phpt +++ b/ext/standard/tests/strings/strnatcmp_basic.phpt @@ -1,80 +1,80 @@ ---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)
+--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 diff --git a/ext/standard/tests/strings/strnatcmp_error.phpt b/ext/standard/tests/strings/strnatcmp_error.phpt index 09cc668af9..2b6d93afee 100644 --- a/ext/standard/tests/strings/strnatcmp_error.phpt +++ b/ext/standard/tests/strings/strnatcmp_error.phpt @@ -1,34 +1,34 @@ ---TEST--
-Test strnatcmp() function : error conditions
---FILE--
-<?php
-/* Prototype : int strnatcmp ( string $str1 , string $str2 )
- * Description: String comparisons using a "natural order" algorithm
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing strnatcmp() : error conditions ***\n";
-
-echo "-- Testing strnatcmp() function with Zero arguments --\n";
-var_dump( strnatcmp() );
-
-echo "\n\n-- Testing strnatcmp() function with more than expected no. of arguments --\n";
-$str1 = "abc1";
-$str2 = "ABC1";
-$extra_arg = 10;
-var_dump( strnatcmp( $str1, $str2, $extra_arg) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing strnatcmp() : error conditions ***
--- Testing strnatcmp() function with Zero arguments --
-
-Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-
--- Testing strnatcmp() function with more than expected no. of arguments --
-
-Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-===DONE===
+--TEST-- +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=== diff --git a/ext/xml/tests/bug49687.phpt b/ext/xml/tests/bug49687.phpt index 3ff19cee7e..6101f9f354 100644 --- a/ext/xml/tests/bug49687.phpt +++ b/ext/xml/tests/bug49687.phpt @@ -1,24 +1,24 @@ ---TEST--
-Bug #49687 Several utf8_decode deficiencies and vulnerabilities
---SKIPIF--
-<?php
-require_once("skipif.inc");
-if (!extension_loaded('xml')) die ("skip xml extension not available");
-?>
---FILE--
-<?php
-
-$tests = array(
- "\x41\xC2\x3E\x42",
- "\xE3\x80\x22",
- "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98",
-);
-foreach ($tests as $t) {
- echo bin2hex(utf8_decode($t)), "\n";
-}
-echo "Done.\n";
---EXPECT--
-413f3e42
-3f22
-413f3f423f433f3f
-Done.
+--TEST-- +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. diff --git a/tests/basic/bug53180.phpt b/tests/basic/bug53180.phpt index 5c2eb76952..16783de8a7 100644 --- a/tests/basic/bug53180.phpt +++ b/tests/basic/bug53180.phpt @@ -1,19 +1,19 @@ ---TEST--
-Bug #53180 (post_max_size=0 partly not working)
---INI--
-post_max_size=0
---POST--
-email=foo&password=bar&submit=Log+on
---FILE--
-<?php
-var_dump($_POST);
-?>
---EXPECT--
-array(3) {
- ["email"]=>
- string(3) "foo"
- ["password"]=>
- string(3) "bar"
- ["submit"]=>
- string(6) "Log on"
-}
+--TEST-- +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" +} diff --git a/tests/basic/req44164.phpt b/tests/basic/req44164.phpt index d0082861f2..7a142f5fb9 100644 --- a/tests/basic/req44164.phpt +++ b/tests/basic/req44164.phpt @@ -1,17 +1,17 @@ ---TEST--
-Req #44164 (Handle "Content-Length" HTTP header when zlib.output_compression active)
---SKIPIF--
-<?php
-if (!function_exists('gzdeflate'))
- die("skip zlib extension required");
-?>
---INI--
-zlib.output_compression=On
---ENV--
-HTTP_ACCEPT_ENCODING=gzip
---FILE--
-<?php
-header("Content-length: 200");
-echo str_repeat("a", 200);
---EXPECT--
-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+--TEST-- +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 diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt index 4da55f2597..6ea7915c25 100644 --- a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt +++ b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt @@ -1,98 +1,98 @@ ---TEST--
-rfc1867 max_file_uploads - empty files shouldn't count
---INI--
-file_uploads=1
-max_file_uploads=2
---POST_RAW--
-Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
------------------------------20896060251896012921717172737
-Content-Disposition: form-data; name="file2"; filename=""
-Content-Type: text/plain-file
-
-
------------------------------20896060251896012921717172737
-Content-Disposition: form-data; name="file3"; filename=""
-Content-Type: text/plain-file
-
-33
------------------------------20896060251896012921717172737
-Content-Disposition: form-data; name="file4"; filename="file4.txt"
-Content-Type: text/plain-file
-
-
------------------------------20896060251896012921717172737
-Content-Disposition: form-data; name="file1"; filename="file1.txt"
-Content-Type: text/plain-file
-
-1
------------------------------20896060251896012921717172737--
---FILE--
-<?php
-var_dump($_FILES);
-var_dump($_POST);
-if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
-}
-if (is_uploaded_file($_FILES["file4"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file4"]["tmp_name"]));
-}
-?>
---EXPECTF--
-array(4) {
- ["file2"]=>
- array(5) {
- ["name"]=>
- string(0) ""
- ["type"]=>
- string(0) ""
- ["tmp_name"]=>
- string(0) ""
- ["error"]=>
- int(4)
- ["size"]=>
- int(0)
- }
- ["file3"]=>
- array(5) {
- ["name"]=>
- string(0) ""
- ["type"]=>
- string(0) ""
- ["tmp_name"]=>
- string(0) ""
- ["error"]=>
- int(4)
- ["size"]=>
- int(0)
- }
- ["file4"]=>
- array(5) {
- ["name"]=>
- string(9) "file4.txt"
- ["type"]=>
- string(15) "text/plain-file"
- ["tmp_name"]=>
- string(%d) "%s"
- ["error"]=>
- int(0)
- ["size"]=>
- int(0)
- }
- ["file1"]=>
- array(5) {
- ["name"]=>
- string(9) "file1.txt"
- ["type"]=>
- string(15) "text/plain-file"
- ["tmp_name"]=>
- string(%d) "%s"
- ["error"]=>
- int(0)
- ["size"]=>
- int(1)
- }
-}
-array(0) {
-}
-string(1) "1"
-string(0) ""
+--TEST-- +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) "" diff --git a/tests/lang/foreachLoop.001.phpt b/tests/lang/foreachLoop.001.phpt index d35f26116d..a7ec701fd1 100644 --- a/tests/lang/foreachLoop.001.phpt +++ b/tests/lang/foreachLoop.001.phpt @@ -1,64 +1,64 @@ ---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"
+--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" diff --git a/tests/lang/foreachLoop.002.phpt b/tests/lang/foreachLoop.002.phpt index 5896124f40..31492953a4 100644 --- a/tests/lang/foreachLoop.002.phpt +++ b/tests/lang/foreachLoop.002.phpt @@ -1,173 +1,173 @@ ---TEST--
-Foreach loop tests - modifying the array during the loop.
---FILE--
-<?php
-
-echo "\nDirectly changing array values.\n";
-$a = array("original.1","original.2","original.3");
-foreach ($a as $k=>$v) {
- $a[$k]="changed.$k";
- var_dump($v);
-}
-var_dump($a);
-
-echo "\nModifying the foreach \$value.\n";
-$a = array("original.1","original.2","original.3");
-foreach ($a as $k=>$v) {
- $v="changed.$k";
-}
-var_dump($a);
-
-
-echo "\nModifying the foreach &\$value.\n";
-$a = array("original.1","original.2","original.3");
-foreach ($a as $k=>&$v) {
- $v="changed.$k";
-}
-var_dump($a);
-
-echo "\nPushing elements onto an unreferenced array.\n";
-$a = array("original.1","original.2","original.3");
-$counter=0;
-foreach ($a as $v) {
- array_push($a, "new.$counter");
-
- //avoid infinite loop if test is failing
- if ($counter++>10) {
- echo "Loop detected\n";
- break;
- }
-}
-var_dump($a);
-
-echo "\nPushing elements onto an unreferenced array, using &\$value.\n";
-$a = array("original.1","original.2","original.3");
-$counter=0;
-foreach ($a as &$v) {
- array_push($a, "new.$counter");
-
- //avoid infinite loop if test is failing
- if ($counter++>10) {
- echo "Loop detected\n";
- break;
- }
-}
-var_dump($a);
-
-echo "\nPopping elements off an unreferenced array.\n";
-$a = array("original.1","original.2","original.3");
-foreach ($a as $v) {
- array_pop($a);
- var_dump($v);
-}
-var_dump($a);
-
-echo "\nPopping elements off an unreferenced array, using &\$value.\n";
-$a = array("original.1","original.2","original.3");
-foreach ($a as &$v) {
- array_pop($a);
- var_dump($v);
-}
-var_dump($a);
-
-?>
---EXPECT--
-
-Directly changing array values.
-string(10) "original.1"
-string(10) "original.2"
-string(10) "original.3"
-array(3) {
- [0]=>
- string(9) "changed.0"
- [1]=>
- string(9) "changed.1"
- [2]=>
- string(9) "changed.2"
-}
-
-Modifying the foreach $value.
-array(3) {
- [0]=>
- string(10) "original.1"
- [1]=>
- string(10) "original.2"
- [2]=>
- string(10) "original.3"
-}
-
-Modifying the foreach &$value.
-array(3) {
- [0]=>
- string(9) "changed.0"
- [1]=>
- string(9) "changed.1"
- [2]=>
- &string(9) "changed.2"
-}
-
-Pushing elements onto an unreferenced array.
-array(6) {
- [0]=>
- string(10) "original.1"
- [1]=>
- string(10) "original.2"
- [2]=>
- string(10) "original.3"
- [3]=>
- string(5) "new.0"
- [4]=>
- string(5) "new.1"
- [5]=>
- string(5) "new.2"
-}
-
-Pushing elements onto an unreferenced array, using &$value.
-Loop detected
-array(15) {
- [0]=>
- string(10) "original.1"
- [1]=>
- string(10) "original.2"
- [2]=>
- string(10) "original.3"
- [3]=>
- string(5) "new.0"
- [4]=>
- string(5) "new.1"
- [5]=>
- string(5) "new.2"
- [6]=>
- string(5) "new.3"
- [7]=>
- string(5) "new.4"
- [8]=>
- string(5) "new.5"
- [9]=>
- string(5) "new.6"
- [10]=>
- string(5) "new.7"
- [11]=>
- &string(5) "new.8"
- [12]=>
- string(5) "new.9"
- [13]=>
- string(6) "new.10"
- [14]=>
- string(6) "new.11"
-}
-
-Popping elements off an unreferenced array.
-string(10) "original.1"
-string(10) "original.2"
-string(10) "original.3"
-array(0) {
-}
-
-Popping elements off an unreferenced array, using &$value.
-string(10) "original.1"
-string(10) "original.2"
-array(1) {
- [0]=>
- string(10) "original.1"
+--TEST-- +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" } diff --git a/tests/lang/foreachLoop.003.phpt b/tests/lang/foreachLoop.003.phpt index d554d0d87f..a62d5dbb3b 100644 --- a/tests/lang/foreachLoop.003.phpt +++ b/tests/lang/foreachLoop.003.phpt @@ -1,46 +1,46 @@ ---TEST--
-Foreach loop tests - error case: not an array.
---FILE--
-<?php
-echo "\nNot an array.\n";
-$a = TRUE;
-foreach ($a as $v) {
- var_dump($v);
-}
-
-$a = null;
-foreach ($a as $v) {
- var_dump($v);
-}
-
-$a = 1;
-foreach ($a as $v) {
- var_dump($v);
-}
-
-$a = 1.5;
-foreach ($a as $v) {
- var_dump($v);
-}
-
-$a = "hello";
-foreach ($a as $v) {
- var_dump($v);
-}
-
-echo "done.\n";
-?>
---EXPECTF--
-
-Not an array.
-
-Warning: Invalid argument supplied for foreach() in %s on line 4
-
-Warning: Invalid argument supplied for foreach() in %s on line 9
-
-Warning: Invalid argument supplied for foreach() in %s on line 14
-
-Warning: Invalid argument supplied for foreach() in %s on line 19
-
-Warning: Invalid argument supplied for foreach() in %s on line 24
-done.
+--TEST-- +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. diff --git a/tests/lang/foreachLoop.004.phpt b/tests/lang/foreachLoop.004.phpt index 178cad0981..3cc1960ca1 100644 --- a/tests/lang/foreachLoop.004.phpt +++ b/tests/lang/foreachLoop.004.phpt @@ -1,76 +1,76 @@ ---TEST--
-Foreach loop tests - using an array element as the $value
---FILE--
-<?php
-
-$a=array("a", "b", "c");
-$v=array();
-foreach($a as $v[0]) {
- var_dump($v);
-}
-var_dump($a);
-var_dump($v);
-
-echo "\n";
-$a=array("a", "b", "c");
-$v=array();
-foreach($a as $k=>$v[0]) {
- var_dump($k, $v);
-}
-var_dump($a);
-var_dump($k, $v);
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(1) "a"
-}
-array(1) {
- [0]=>
- string(1) "b"
-}
-array(1) {
- [0]=>
- string(1) "c"
-}
-array(3) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- string(1) "c"
-}
-array(1) {
- [0]=>
- string(1) "c"
-}
-
-int(0)
-array(1) {
- [0]=>
- string(1) "a"
-}
-int(1)
-array(1) {
- [0]=>
- string(1) "b"
-}
-int(2)
-array(1) {
- [0]=>
- string(1) "c"
-}
-array(3) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- string(1) "c"
-}
-int(2)
-array(1) {
- [0]=>
- string(1) "c"
+--TEST-- +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" } diff --git a/tests/lang/foreachLoop.005.phpt b/tests/lang/foreachLoop.005.phpt index ae6ed3aa28..c7e4ceb8e7 100644 --- a/tests/lang/foreachLoop.005.phpt +++ b/tests/lang/foreachLoop.005.phpt @@ -1,23 +1,23 @@ ---TEST--
-Foreach loop tests - modifying the array during the loop: special case. Behaviour is good since php 5.2.2.
---FILE--
-<?php
-$a = array("original.0","original.1","original.2");
-foreach ($a as $k=>&$v){
- $a[$k] = "changed.$k";
- echo "After changing \$a directly, \$v@$k is: $v\n";
-}
-//--- Expected output:
-//After changing $a directly, $v@0 is: changed.0
-//After changing $a directly, $v@1 is: changed.1
-//After changing $a directly, $v@2 is: changed.2
-//--- Actual output from php.net before 5.2.2:
-//After changing $a directly, $v@0 is: changed.0
-//After changing $a directly, $v@1 is: original.1
-//After changing $a directly, $v@2 is: original.2
-
-?>
---EXPECT--
-After changing $a directly, $v@0 is: changed.0
-After changing $a directly, $v@1 is: changed.1
-After changing $a directly, $v@2 is: changed.2
+--TEST-- +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 diff --git a/tests/lang/foreachLoop.006.phpt b/tests/lang/foreachLoop.006.phpt index d31ea64563..f7563dccd0 100644 --- a/tests/lang/foreachLoop.006.phpt +++ b/tests/lang/foreachLoop.006.phpt @@ -1,11 +1,11 @@ ---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--
+--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 diff --git a/tests/lang/foreachLoop.009.phpt b/tests/lang/foreachLoop.009.phpt index df51fd6be4..90aa33953b 100644 --- a/tests/lang/foreachLoop.009.phpt +++ b/tests/lang/foreachLoop.009.phpt @@ -1,78 +1,78 @@ ---TEST--
-Foreach loop tests - foreach operates on the original array if the array is referenced outside the loop.
---FILE--
-<?php
-// From php.net/foreach:
-// "Unless the array is referenced, foreach operates on a copy of the specified array."
-
-echo "\nRemove elements from a referenced array during loop\n";
-$refedArray=array("original.0", "original.1", "original.2");
-$ref=&$refedArray;
-foreach ($refedArray as $k=>$v1) {
- array_pop($refedArray);
- echo "key: $k; value: $v1\n";
-}
-
-echo "\nRemove elements from a referenced array during loop, using &\$value\n";
-$refedArray=array("original.0", "original.1", "original.2");
-$ref=&$refedArray;
-foreach ($refedArray as $k=>&$v2) {
- array_pop($refedArray);
- echo "key: $k; value: $v2\n";
-}
-
-echo "\nAdd elements to a referenced array during loop\n";
-$refedArray=array("original.0", "original.1", "original.2");
-$ref=&$refedArray;
-$count=0;
-foreach ($refedArray as $k=>$v3) {
- array_push($refedArray, "new.$k");
- echo "key: $k; value: $v3\n";
-
- if ($count++>5) {
- echo "Loop detected, as expected.\n";
- break;
- }
-}
-
-echo "\nAdd elements to a referenced array during loop, using &\$value\n";
-$refedArray=array("original.0", "original.1", "original.2");
-$ref=&$refedArray;
-$count=0;
-foreach ($refedArray as $k=>&$v4) {
- array_push($refedArray, "new.$k");
- echo "key: $k; value: $v4\n";
-
- if ($count++>5) {
- echo "Loop detected, as expected.\n";
- break;
- }
-}
-
-?>
---EXPECT--
-
-Remove elements from a referenced array during loop
-key: 0; value: original.0
-key: 1; value: original.1
-key: 2; value: original.2
-
-Remove elements from a referenced array during loop, using &$value
-key: 0; value: original.0
-key: 1; value: original.1
-
-Add elements to a referenced array during loop
-key: 0; value: original.0
-key: 1; value: original.1
-key: 2; value: original.2
-
-Add elements to a referenced array during loop, using &$value
-key: 0; value: original.0
-key: 1; value: original.1
-key: 2; value: original.2
-key: 3; value: new.0
-key: 4; value: new.1
-key: 5; value: new.2
-key: 6; value: new.3
-Loop detected, as expected.
-
+--TEST-- +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. + diff --git a/tests/lang/foreachLoop.010.phpt b/tests/lang/foreachLoop.010.phpt index 31f6e8cc49..c021a80c39 100644 --- a/tests/lang/foreachLoop.010.phpt +++ b/tests/lang/foreachLoop.010.phpt @@ -1,40 +1,40 @@ ---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)
+--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) diff --git a/tests/lang/foreachLoop.011.phpt b/tests/lang/foreachLoop.011.phpt index 8527a8833e..6ceebd8a50 100644 --- a/tests/lang/foreachLoop.011.phpt +++ b/tests/lang/foreachLoop.011.phpt @@ -1,33 +1,33 @@ ---TEST--
-Changing from an interable type to a non iterable type during the iteration
---FILE--
-<?php
-echo "\nChange from array to non iterable:\n";
-$a = array(1,2,3);
-$b=&$a;
-foreach ($a as $v) {
- var_dump($v);
- $b=1;
-}
-
-echo "\nChange from object to non iterable:\n";
-$a = new stdClass;
-$a->a=1;
-$a->b=2;
-$b=&$a;
-foreach ($a as $v) {
- var_dump($v);
- $b='x';
-}
-
-?>
---EXPECTF--
-
-Change from array to non iterable:
-int(1)
-int(2)
-int(3)
-
-Change from object to non iterable:
-int(1)
-int(2)
+--TEST-- +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) diff --git a/tests/lang/foreachLoop.012.phpt b/tests/lang/foreachLoop.012.phpt index 1165b74a58..3652a71aed 100644 --- a/tests/lang/foreachLoop.012.phpt +++ b/tests/lang/foreachLoop.012.phpt @@ -1,494 +1,494 @@ ---TEST--
-Directly modifying an unreferenced array when foreach'ing over it.
---FILE--
-<?php
-
-define('MAX_LOOPS',5);
-
-function withRefValue($elements, $transform) {
- echo "\n---( Array with $elements element(s): )---\n";
- //Build array:
- for ($i=0; $i<$elements; $i++) {
- $a[] = "v.$i";
- }
- $counter=0;
-
- echo "--> State of array before loop:\n";
- var_dump($a);
-
- echo "--> Do loop:\n";
- foreach ($a as $k=>$v) {
- echo " iteration $counter: \$k=$k; \$v=$v\n";
- eval($transform);
- $counter++;
- if ($counter>MAX_LOOPS) {
- echo " ** Stuck in a loop! **\n";
- break;
- }
- }
-
- echo "--> State of array after loop:\n";
- var_dump($a);
-}
-
-
-echo "\nPopping elements off end of an unreferenced array";
-$transform = 'array_pop($a);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nShift elements off start of an unreferenced array";
-$transform = 'array_shift($a);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nRemove current element of an unreferenced array";
-$transform = 'unset($a[$k]);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nAdding elements to the end of an unreferenced array";
-$transform = 'array_push($a, "new.$counter");';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nAdding elements to the start of an unreferenced array";
-$transform = 'array_unshift($a, "new.$counter");';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-?>
---EXPECTF--
-
-Popping elements off end of an unreferenced array
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Shift elements off start of an unreferenced array
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Remove current element of an unreferenced array
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Adding elements to the end of an unreferenced array
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(5) "new.0"
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(5) "new.0"
- [3]=>
- string(5) "new.1"
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(6) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(5) "new.0"
- [4]=>
- string(5) "new.1"
- [5]=>
- string(5) "new.2"
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(8) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
- [4]=>
- string(5) "new.0"
- [5]=>
- string(5) "new.1"
- [6]=>
- string(5) "new.2"
- [7]=>
- string(5) "new.3"
-}
-
-
-
-Adding elements to the start of an unreferenced array
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(2) {
- [0]=>
- string(5) "new.0"
- [1]=>
- string(3) "v.0"
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(4) {
- [0]=>
- string(5) "new.1"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(3) "v.0"
- [3]=>
- string(3) "v.1"
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(6) {
- [0]=>
- string(5) "new.2"
- [1]=>
- string(5) "new.1"
- [2]=>
- string(5) "new.0"
- [3]=>
- string(3) "v.0"
- [4]=>
- string(3) "v.1"
- [5]=>
- string(3) "v.2"
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(8) {
- [0]=>
- string(5) "new.3"
- [1]=>
- string(5) "new.2"
- [2]=>
- string(5) "new.1"
- [3]=>
- string(5) "new.0"
- [4]=>
- string(3) "v.0"
- [5]=>
- string(3) "v.1"
- [6]=>
- string(3) "v.2"
- [7]=>
- string(3) "v.3"
-}
+--TEST-- +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" +} diff --git a/tests/lang/foreachLoop.013.phpt b/tests/lang/foreachLoop.013.phpt index ea728156f0..ba1bc89628 100644 --- a/tests/lang/foreachLoop.013.phpt +++ b/tests/lang/foreachLoop.013.phpt @@ -1,535 +1,535 @@ ---TEST--
-Directly modifying an unreferenced array when foreach'ing over it while using &$value syntax.
---FILE--
-<?php
-
-define('MAX_LOOPS',5);
-
-function withRefValue($elements, $transform) {
- echo "\n---( Array with $elements element(s): )---\n";
- //Build array:
- for ($i=0; $i<$elements; $i++) {
- $a[] = "v.$i";
- }
- $counter=0;
-
- echo "--> State of array before loop:\n";
- var_dump($a);
-
- echo "--> Do loop:\n";
- foreach ($a as $k=>&$v) {
- echo " iteration $counter: \$k=$k; \$v=$v\n";
- eval($transform);
- $counter++;
- if ($counter>MAX_LOOPS) {
- echo " ** Stuck in a loop! **\n";
- break;
- }
- }
-
- echo "--> State of array after loop:\n";
- var_dump($a);
-}
-
-
-echo "\nPopping elements off end of an unreferenced array, using &\$value.";
-$transform = 'array_pop($a);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nShift elements off start of an unreferenced array, using &\$value.";
-$transform = 'array_shift($a);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nRemove current element of an unreferenced array, using &\$value.";
-$transform = 'unset($a[$k]);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nAdding elements to the end of an unreferenced array, using &\$value.";
-$transform = 'array_push($a, "new.$counter");';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nAdding elements to the start of an unreferenced array, using &\$value.";
-$transform = 'array_unshift($a, "new.$counter");';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-?>
---EXPECT--
-
-Popping elements off end of an unreferenced array, using &$value.
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(1) {
- [0]=>
- &string(3) "v.0"
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- &string(3) "v.1"
-}
-
-
-
-Shift elements off start of an unreferenced array, using &$value.
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=0; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=0; $v=v.1
- iteration 2: $k=0; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=0; $v=v.1
- iteration 2: $k=0; $v=v.2
- iteration 3: $k=0; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Remove current element of an unreferenced array, using &$value.
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Adding elements to the end of an unreferenced array, using &$value.
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=new.0
- iteration 2: $k=2; $v=new.1
- iteration 3: $k=3; $v=new.2
- iteration 4: $k=4; $v=new.3
- iteration 5: $k=5; $v=new.4
- ** Stuck in a loop! **
---> State of array after loop:
-array(7) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(5) "new.1"
- [3]=>
- string(5) "new.2"
- [4]=>
- string(5) "new.3"
- [5]=>
- &string(5) "new.4"
- [6]=>
- string(5) "new.5"
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=new.0
- iteration 3: $k=3; $v=new.1
- iteration 4: $k=4; $v=new.2
- iteration 5: $k=5; $v=new.3
- ** Stuck in a loop! **
---> State of array after loop:
-array(8) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(5) "new.0"
- [3]=>
- string(5) "new.1"
- [4]=>
- string(5) "new.2"
- [5]=>
- &string(5) "new.3"
- [6]=>
- string(5) "new.4"
- [7]=>
- string(5) "new.5"
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=new.0
- iteration 4: $k=4; $v=new.1
- iteration 5: $k=5; $v=new.2
- ** Stuck in a loop! **
---> State of array after loop:
-array(9) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(5) "new.0"
- [4]=>
- string(5) "new.1"
- [5]=>
- &string(5) "new.2"
- [6]=>
- string(5) "new.3"
- [7]=>
- string(5) "new.4"
- [8]=>
- string(5) "new.5"
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
- iteration 4: $k=4; $v=new.0
- iteration 5: $k=5; $v=new.1
- ** Stuck in a loop! **
---> State of array after loop:
-array(10) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
- [4]=>
- string(5) "new.0"
- [5]=>
- &string(5) "new.1"
- [6]=>
- string(5) "new.2"
- [7]=>
- string(5) "new.3"
- [8]=>
- string(5) "new.4"
- [9]=>
- string(5) "new.5"
-}
-
-
-
-Adding elements to the start of an unreferenced array, using &$value.
----( Array with 1 element(s): )---
---> State of array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(2) {
- [0]=>
- string(5) "new.0"
- [1]=>
- &string(3) "v.0"
-}
-
----( Array with 2 element(s): )---
---> State of array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=2; $v=v.1
---> State of array after loop:
-array(4) {
- [0]=>
- string(5) "new.1"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(3) "v.0"
- [3]=>
- &string(3) "v.1"
-}
-
----( Array with 3 element(s): )---
---> State of array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=3; $v=v.2
---> State of array after loop:
-array(5) {
- [0]=>
- string(5) "new.1"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(3) "v.0"
- [3]=>
- string(3) "v.1"
- [4]=>
- &string(3) "v.2"
-}
-
----( Array with 4 element(s): )---
---> State of array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=4; $v=v.3
---> State of array after loop:
-array(6) {
- [0]=>
- string(5) "new.1"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(3) "v.0"
- [3]=>
- string(3) "v.1"
- [4]=>
- string(3) "v.2"
- [5]=>
- &string(3) "v.3"
-}
+--TEST-- +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" +} diff --git a/tests/lang/foreachLoop.014.phpt b/tests/lang/foreachLoop.014.phpt index 9b179ab22a..770ee9f92e 100644 --- a/tests/lang/foreachLoop.014.phpt +++ b/tests/lang/foreachLoop.014.phpt @@ -1,495 +1,495 @@ ---TEST--
-Directly modifying a REFERENCED array when foreach'ing over it.
---FILE--
-<?php
-
-define('MAX_LOOPS',5);
-
-function withRefValue($elements, $transform) {
- echo "\n---( Array with $elements element(s): )---\n";
- //Build array:
- for ($i=0; $i<$elements; $i++) {
- $a[] = "v.$i";
- }
- $counter=0;
-
- $ref = &$a;
-
- echo "--> State of referenced array before loop:\n";
- var_dump($a);
-
- echo "--> Do loop:\n";
- foreach ($a as $k=>$v) {
- echo " iteration $counter: \$k=$k; \$v=$v\n";
- eval($transform);
- $counter++;
- if ($counter>MAX_LOOPS) {
- echo " ** Stuck in a loop! **\n";
- break;
- }
- }
-
- echo "--> State of array after loop:\n";
- var_dump($a);
-}
-
-
-echo "\nPopping elements off end of a referenced array";
-$transform = 'array_pop($a);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nShift elements off start of a referenced array";
-$transform = 'array_shift($a);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nRemove current element of a referenced array";
-$transform = 'unset($a[$k]);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nAdding elements to the end of a referenced array";
-$transform = 'array_push($a, "new.$counter");';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nAdding elements to the start of a referenced array";
-$transform = 'array_unshift($a, "new.$counter");';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-?>
---EXPECTF--
-Popping elements off end of a referenced array
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Shift elements off start of a referenced array
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Remove current element of a referenced array
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Adding elements to the end of a referenced array
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(5) "new.0"
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(5) "new.0"
- [3]=>
- string(5) "new.1"
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(6) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(5) "new.0"
- [4]=>
- string(5) "new.1"
- [5]=>
- string(5) "new.2"
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(8) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
- [4]=>
- string(5) "new.0"
- [5]=>
- string(5) "new.1"
- [6]=>
- string(5) "new.2"
- [7]=>
- string(5) "new.3"
-}
-
-
-
-Adding elements to the start of a referenced array
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(2) {
- [0]=>
- string(5) "new.0"
- [1]=>
- string(3) "v.0"
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(4) {
- [0]=>
- string(5) "new.1"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(3) "v.0"
- [3]=>
- string(3) "v.1"
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(6) {
- [0]=>
- string(5) "new.2"
- [1]=>
- string(5) "new.1"
- [2]=>
- string(5) "new.0"
- [3]=>
- string(3) "v.0"
- [4]=>
- string(3) "v.1"
- [5]=>
- string(3) "v.2"
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(8) {
- [0]=>
- string(5) "new.3"
- [1]=>
- string(5) "new.2"
- [2]=>
- string(5) "new.1"
- [3]=>
- string(5) "new.0"
- [4]=>
- string(3) "v.0"
- [5]=>
- string(3) "v.1"
- [6]=>
- string(3) "v.2"
- [7]=>
- string(3) "v.3"
-}
+--TEST-- +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" +} diff --git a/tests/lang/foreachLoop.015.phpt b/tests/lang/foreachLoop.015.phpt index a4ee09d6a9..f7f5389395 100644 --- a/tests/lang/foreachLoop.015.phpt +++ b/tests/lang/foreachLoop.015.phpt @@ -1,537 +1,537 @@ ---TEST--
-Directly modifying a REFERENCED array when foreach'ing over it while using &$value syntax.
---FILE--
-<?php
-
-define('MAX_LOOPS',5);
-
-function withRefValue($elements, $transform) {
- echo "\n---( Array with $elements element(s): )---\n";
- //Build array:
- for ($i=0; $i<$elements; $i++) {
- $a[] = "v.$i";
- }
- $counter=0;
-
- $ref = &$a;
-
- echo "--> State of referenced array before loop:\n";
- var_dump($a);
-
- echo "--> Do loop:\n";
- foreach ($a as $k=>&$v) {
- echo " iteration $counter: \$k=$k; \$v=$v\n";
- eval($transform);
- $counter++;
- if ($counter>MAX_LOOPS) {
- echo " ** Stuck in a loop! **\n";
- break;
- }
- }
-
- echo "--> State of array after loop:\n";
- var_dump($a);
-}
-
-
-echo "\nPopping elements off end of a referenced array, using &\$value";
-$transform = 'array_pop($a);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nShift elements off start of a referenced array, using &\$value";
-$transform = 'array_shift($a);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nRemove current element of a referenced array, using &\$value";
-$transform = 'unset($a[$k]);';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nAdding elements to the end of a referenced array, using &\$value";
-$transform = 'array_push($a, "new.$counter");';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-echo "\n\n\nAdding elements to the start of a referenced array, using &\$value";
-$transform = 'array_unshift($a, "new.$counter");';
-withRefValue(1, $transform);
-withRefValue(2, $transform);
-withRefValue(3, $transform);
-withRefValue(4, $transform);
-
-?>
---EXPECT--
-
-Popping elements off end of a referenced array, using &$value
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(1) {
- [0]=>
- &string(3) "v.0"
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- &string(3) "v.1"
-}
-
-
-
-Shift elements off start of a referenced array, using &$value
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=0; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=0; $v=v.1
- iteration 2: $k=0; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=0; $v=v.1
- iteration 2: $k=0; $v=v.2
- iteration 3: $k=0; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Remove current element of a referenced array, using &$value
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(0) {
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
---> State of array after loop:
-array(0) {
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
---> State of array after loop:
-array(0) {
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
---> State of array after loop:
-array(0) {
-}
-
-
-
-Adding elements to the end of a referenced array, using &$value
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=new.0
- iteration 2: $k=2; $v=new.1
- iteration 3: $k=3; $v=new.2
- iteration 4: $k=4; $v=new.3
- iteration 5: $k=5; $v=new.4
- ** Stuck in a loop! **
---> State of array after loop:
-array(7) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(5) "new.1"
- [3]=>
- string(5) "new.2"
- [4]=>
- string(5) "new.3"
- [5]=>
- &string(5) "new.4"
- [6]=>
- string(5) "new.5"
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=new.0
- iteration 3: $k=3; $v=new.1
- iteration 4: $k=4; $v=new.2
- iteration 5: $k=5; $v=new.3
- ** Stuck in a loop! **
---> State of array after loop:
-array(8) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(5) "new.0"
- [3]=>
- string(5) "new.1"
- [4]=>
- string(5) "new.2"
- [5]=>
- &string(5) "new.3"
- [6]=>
- string(5) "new.4"
- [7]=>
- string(5) "new.5"
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=new.0
- iteration 4: $k=4; $v=new.1
- iteration 5: $k=5; $v=new.2
- ** Stuck in a loop! **
---> State of array after loop:
-array(9) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(5) "new.0"
- [4]=>
- string(5) "new.1"
- [5]=>
- &string(5) "new.2"
- [6]=>
- string(5) "new.3"
- [7]=>
- string(5) "new.4"
- [8]=>
- string(5) "new.5"
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=1; $v=v.1
- iteration 2: $k=2; $v=v.2
- iteration 3: $k=3; $v=v.3
- iteration 4: $k=4; $v=new.0
- iteration 5: $k=5; $v=new.1
- ** Stuck in a loop! **
---> State of array after loop:
-array(10) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
- [4]=>
- string(5) "new.0"
- [5]=>
- &string(5) "new.1"
- [6]=>
- string(5) "new.2"
- [7]=>
- string(5) "new.3"
- [8]=>
- string(5) "new.4"
- [9]=>
- string(5) "new.5"
-}
-
-
-
-Adding elements to the start of a referenced array, using &$value
----( Array with 1 element(s): )---
---> State of referenced array before loop:
-array(1) {
- [0]=>
- string(3) "v.0"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
---> State of array after loop:
-array(2) {
- [0]=>
- string(5) "new.0"
- [1]=>
- &string(3) "v.0"
-}
-
----( Array with 2 element(s): )---
---> State of referenced array before loop:
-array(2) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=2; $v=v.1
---> State of array after loop:
-array(4) {
- [0]=>
- string(5) "new.1"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(3) "v.0"
- [3]=>
- &string(3) "v.1"
-}
-
----( Array with 3 element(s): )---
---> State of referenced array before loop:
-array(3) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=3; $v=v.2
---> State of array after loop:
-array(5) {
- [0]=>
- string(5) "new.1"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(3) "v.0"
- [3]=>
- string(3) "v.1"
- [4]=>
- &string(3) "v.2"
-}
-
----( Array with 4 element(s): )---
---> State of referenced array before loop:
-array(4) {
- [0]=>
- string(3) "v.0"
- [1]=>
- string(3) "v.1"
- [2]=>
- string(3) "v.2"
- [3]=>
- string(3) "v.3"
-}
---> Do loop:
- iteration 0: $k=0; $v=v.0
- iteration 1: $k=4; $v=v.3
---> State of array after loop:
-array(6) {
- [0]=>
- string(5) "new.1"
- [1]=>
- string(5) "new.0"
- [2]=>
- string(3) "v.0"
- [3]=>
- string(3) "v.1"
- [4]=>
- string(3) "v.2"
- [5]=>
- &string(3) "v.3"
-}
+--TEST-- +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" +} diff --git a/tests/lang/foreachLoop.016.phpt b/tests/lang/foreachLoop.016.phpt index d570aba316..91c96f694d 100644 --- a/tests/lang/foreachLoop.016.phpt +++ b/tests/lang/foreachLoop.016.phpt @@ -1,206 +1,206 @@ ---TEST--
-Ensure foreach splits the iterated entity from its cow reference set, for all sorts of iterated entities.
---FILE--
-<?php
- error_reporting(E_ALL & ~E_STRICT);
-
- echo "\n" . '$a' . "\n";
- $b = $a = array('original');
- foreach($a as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '${\'a\'}' . "\n";
- $b = $a = array('original');
- foreach(${'a'} as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '$$a' . "\n";
- $a = 'blah';
- $$a = array('original');
- $b = $$a;
- foreach($$a as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '$a[0]' . "\n";
- $b = $a[0] = array('original');
- foreach($a[0] as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '$a[0][0]' . "\n";
- $b = $a[0][0] = array('original');
- foreach($a[0][0] as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '$a->b' . "\n";
- $b = $a->b = array('original');
- foreach($a->b as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '$a->b->c' . "\n";
- $b = $a->b->c = array('original');
- foreach($a->b as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '$a->b[0]' . "\n";
- $b = $a->b[0] = array('original');
- foreach($a->b[0] as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '$a->b[0][0]' . "\n";
- $b = $a->b[0][0] = array('original');
- foreach($a->b[0][0] as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . '$a->b[0]->c' . "\n";
- $b = $a->b[0]->c = array('original');
- foreach($a->b[0]->c as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- class C {
- public static $a;
- }
-
- echo "\n" . 'C::$a' . "\n";
- C::$a = array('original');
- $b = C::$a;
- foreach(C::$a as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset($a, $b);
-
- echo "\n" . 'C::$a[0]' . "\n";
- C::$a[0] = array('original');
- $b = C::$a[0];
- foreach(C::$a[0] as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset(C::$a[0], $b);
-
- echo "\n" . 'C::$a[0]->b' . "\n";
- C::$a[0]->b = array('original');
- $b = C::$a[0]->b;
- foreach(C::$a[0]->b as $k=>&$v) {
- $v = 'changed';
- }
- var_dump($b);
- unset(C::$a[0]->b, $b);
-?>
---EXPECTF--
-
-$a
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-${'a'}
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-$$a
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-$a[0]
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-$a[0][0]
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-$a->b
-
-Warning: Creating default object from empty value in %s on line %d
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-$a->b->c
-
-Warning: Creating default object from empty value in %s on line %d
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-$a->b[0]
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-$a->b[0][0]
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-$a->b[0]->c
-
-Warning: Creating default object from empty value in %s on line %d
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-C::$a
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-C::$a[0]
-array(1) {
- [0]=>
- string(8) "original"
-}
-
-C::$a[0]->b
-
-Warning: Creating default object from empty value in %s on line %d
-array(1) {
- [0]=>
- string(8) "original"
-}
+--TEST-- +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" +} diff --git a/tests/lang/foreachLoop.017.phpt b/tests/lang/foreachLoop.017.phpt index 4c3a1f6c3e..987fe3cb27 100644 --- a/tests/lang/foreachLoop.017.phpt +++ b/tests/lang/foreachLoop.017.phpt @@ -1,11 +1,11 @@ ---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
+--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 diff --git a/tests/lang/operators/add_basiclong_64bit.phpt b/tests/lang/operators/add_basiclong_64bit.phpt index cae8f4f1fb..eb55d5f210 100644 --- a/tests/lang/operators/add_basiclong_64bit.phpt +++ b/tests/lang/operators/add_basiclong_64bit.phpt @@ -1,44 +1,44 @@ ---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--
+--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)
-===DONE===
+float(0) +===DONE=== diff --git a/tests/lang/operators/add_variationStr.phpt b/tests/lang/operators/add_variationStr.phpt index 264c5c1bb9..9bf11ec698 100644 --- a/tests/lang/operators/add_variationStr.phpt +++ b/tests/lang/operators/add_variationStr.phpt @@ -1,26 +1,26 @@ ---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--
+--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)
-===DONE===
+int(0) +===DONE=== diff --git a/tests/lang/operators/bitwiseAnd_variationStr.phpt b/tests/lang/operators/bitwiseAnd_variationStr.phpt index 26022705fc..5b7cb10b12 100644 --- a/tests/lang/operators/bitwiseAnd_variationStr.phpt +++ b/tests/lang/operators/bitwiseAnd_variationStr.phpt @@ -1,26 +1,26 @@ ---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--
+--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"
-===DONE===
+string(8) "61352e39" +===DONE=== diff --git a/tests/lang/operators/bitwiseNot_variationStr.phpt b/tests/lang/operators/bitwiseNot_variationStr.phpt index 3e7b698680..98bca9e473 100644 --- a/tests/lang/operators/bitwiseNot_variationStr.phpt +++ b/tests/lang/operators/bitwiseNot_variationStr.phpt @@ -1,22 +1,22 @@ ---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--
+--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"
-===DONE===
+string(8) "9ecad1c6" +===DONE=== diff --git a/tests/lang/operators/bitwiseOr_variationStr.phpt b/tests/lang/operators/bitwiseOr_variationStr.phpt index 6c31477884..2d1d353788 100644 --- a/tests/lang/operators/bitwiseOr_variationStr.phpt +++ b/tests/lang/operators/bitwiseOr_variationStr.phpt @@ -1,26 +1,26 @@ ---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--
+--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"
-===DONE===
+string(8) "61352e39" +===DONE=== diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt index 69fd90f1c8..ddfd2f7c6d 100644 --- a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt @@ -1,424 +1,424 @@ ---TEST--
-Test << operator : various numbers as strings
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-
-$strVals = array(
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
- "a5.9"
-);
-
-error_reporting(E_ERROR);
-
-foreach ($strVals as $strVal) {
- foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' << '$otherVal' ---\n";
- try {
- var_dump($strVal<<$otherVal);
- } catch (ArithmeticError $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
- }
-}
-
-
-?>
-===DONE===
---EXPECT--
---- testing: '0' << '0' ---
-int(0)
---- testing: '0' << '65' ---
-int(0)
---- testing: '0' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '0' << '1.2' ---
-int(0)
---- testing: '0' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '0' << 'abc' ---
-int(0)
---- testing: '0' << '123abc' ---
-int(0)
---- testing: '0' << '123e5' ---
-int(0)
---- testing: '0' << '123e5xyz' ---
-int(0)
---- testing: '0' << ' 123abc' ---
-int(0)
---- testing: '0' << '123 abc' ---
-int(0)
---- testing: '0' << '123abc ' ---
-int(0)
---- testing: '0' << '3.4a' ---
-int(0)
---- testing: '0' << 'a5.9' ---
-int(0)
---- testing: '65' << '0' ---
-int(65)
---- testing: '65' << '65' ---
-int(0)
---- testing: '65' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '65' << '1.2' ---
-int(130)
---- testing: '65' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '65' << 'abc' ---
-int(65)
---- testing: '65' << '123abc' ---
-int(0)
---- testing: '65' << '123e5' ---
-int(0)
---- testing: '65' << '123e5xyz' ---
-int(0)
---- testing: '65' << ' 123abc' ---
-int(0)
---- testing: '65' << '123 abc' ---
-int(0)
---- testing: '65' << '123abc ' ---
-int(0)
---- testing: '65' << '3.4a' ---
-int(520)
---- testing: '65' << 'a5.9' ---
-int(65)
---- testing: '-44' << '0' ---
-int(-44)
---- testing: '-44' << '65' ---
-int(0)
---- testing: '-44' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '-44' << '1.2' ---
-int(-88)
---- testing: '-44' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '-44' << 'abc' ---
-int(-44)
---- testing: '-44' << '123abc' ---
-int(0)
---- testing: '-44' << '123e5' ---
-int(0)
---- testing: '-44' << '123e5xyz' ---
-int(0)
---- testing: '-44' << ' 123abc' ---
-int(0)
---- testing: '-44' << '123 abc' ---
-int(0)
---- testing: '-44' << '123abc ' ---
-int(0)
---- testing: '-44' << '3.4a' ---
-int(-352)
---- testing: '-44' << 'a5.9' ---
-int(-44)
---- testing: '1.2' << '0' ---
-int(1)
---- testing: '1.2' << '65' ---
-int(0)
---- testing: '1.2' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '1.2' << '1.2' ---
-int(2)
---- testing: '1.2' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '1.2' << 'abc' ---
-int(1)
---- testing: '1.2' << '123abc' ---
-int(0)
---- testing: '1.2' << '123e5' ---
-int(0)
---- testing: '1.2' << '123e5xyz' ---
-int(0)
---- testing: '1.2' << ' 123abc' ---
-int(0)
---- testing: '1.2' << '123 abc' ---
-int(0)
---- testing: '1.2' << '123abc ' ---
-int(0)
---- testing: '1.2' << '3.4a' ---
-int(8)
---- testing: '1.2' << 'a5.9' ---
-int(1)
---- testing: '-7.7' << '0' ---
-int(-7)
---- testing: '-7.7' << '65' ---
-int(0)
---- testing: '-7.7' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '-7.7' << '1.2' ---
-int(-14)
---- testing: '-7.7' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '-7.7' << 'abc' ---
-int(-7)
---- testing: '-7.7' << '123abc' ---
-int(0)
---- testing: '-7.7' << '123e5' ---
-int(0)
---- testing: '-7.7' << '123e5xyz' ---
-int(0)
---- testing: '-7.7' << ' 123abc' ---
-int(0)
---- testing: '-7.7' << '123 abc' ---
-int(0)
---- testing: '-7.7' << '123abc ' ---
-int(0)
---- testing: '-7.7' << '3.4a' ---
-int(-56)
---- testing: '-7.7' << 'a5.9' ---
-int(-7)
---- testing: 'abc' << '0' ---
-int(0)
---- testing: 'abc' << '65' ---
-int(0)
---- testing: 'abc' << '-44' ---
-Exception: Bit shift by negative number
---- testing: 'abc' << '1.2' ---
-int(0)
---- testing: 'abc' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: 'abc' << 'abc' ---
-int(0)
---- testing: 'abc' << '123abc' ---
-int(0)
---- testing: 'abc' << '123e5' ---
-int(0)
---- testing: 'abc' << '123e5xyz' ---
-int(0)
---- testing: 'abc' << ' 123abc' ---
-int(0)
---- testing: 'abc' << '123 abc' ---
-int(0)
---- testing: 'abc' << '123abc ' ---
-int(0)
---- testing: 'abc' << '3.4a' ---
-int(0)
---- testing: 'abc' << 'a5.9' ---
-int(0)
---- testing: '123abc' << '0' ---
-int(123)
---- testing: '123abc' << '65' ---
-int(0)
---- testing: '123abc' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '123abc' << '1.2' ---
-int(246)
---- testing: '123abc' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '123abc' << 'abc' ---
-int(123)
---- testing: '123abc' << '123abc' ---
-int(0)
---- testing: '123abc' << '123e5' ---
-int(0)
---- testing: '123abc' << '123e5xyz' ---
-int(0)
---- testing: '123abc' << ' 123abc' ---
-int(0)
---- testing: '123abc' << '123 abc' ---
-int(0)
---- testing: '123abc' << '123abc ' ---
-int(0)
---- testing: '123abc' << '3.4a' ---
-int(984)
---- testing: '123abc' << 'a5.9' ---
-int(123)
---- testing: '123e5' << '0' ---
-int(12300000)
---- testing: '123e5' << '65' ---
-int(0)
---- testing: '123e5' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '123e5' << '1.2' ---
-int(24600000)
---- testing: '123e5' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '123e5' << 'abc' ---
-int(12300000)
---- testing: '123e5' << '123abc' ---
-int(0)
---- testing: '123e5' << '123e5' ---
-int(0)
---- testing: '123e5' << '123e5xyz' ---
-int(0)
---- testing: '123e5' << ' 123abc' ---
-int(0)
---- testing: '123e5' << '123 abc' ---
-int(0)
---- testing: '123e5' << '123abc ' ---
-int(0)
---- testing: '123e5' << '3.4a' ---
-int(98400000)
---- testing: '123e5' << 'a5.9' ---
-int(12300000)
---- testing: '123e5xyz' << '0' ---
-int(12300000)
---- testing: '123e5xyz' << '65' ---
-int(0)
---- testing: '123e5xyz' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '123e5xyz' << '1.2' ---
-int(24600000)
---- testing: '123e5xyz' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '123e5xyz' << 'abc' ---
-int(12300000)
---- testing: '123e5xyz' << '123abc' ---
-int(0)
---- testing: '123e5xyz' << '123e5' ---
-int(0)
---- testing: '123e5xyz' << '123e5xyz' ---
-int(0)
---- testing: '123e5xyz' << ' 123abc' ---
-int(0)
---- testing: '123e5xyz' << '123 abc' ---
-int(0)
---- testing: '123e5xyz' << '123abc ' ---
-int(0)
---- testing: '123e5xyz' << '3.4a' ---
-int(98400000)
---- testing: '123e5xyz' << 'a5.9' ---
-int(12300000)
---- testing: ' 123abc' << '0' ---
-int(123)
---- testing: ' 123abc' << '65' ---
-int(0)
---- testing: ' 123abc' << '-44' ---
-Exception: Bit shift by negative number
---- testing: ' 123abc' << '1.2' ---
-int(246)
---- testing: ' 123abc' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: ' 123abc' << 'abc' ---
-int(123)
---- testing: ' 123abc' << '123abc' ---
-int(0)
---- testing: ' 123abc' << '123e5' ---
-int(0)
---- testing: ' 123abc' << '123e5xyz' ---
-int(0)
---- testing: ' 123abc' << ' 123abc' ---
-int(0)
---- testing: ' 123abc' << '123 abc' ---
-int(0)
---- testing: ' 123abc' << '123abc ' ---
-int(0)
---- testing: ' 123abc' << '3.4a' ---
-int(984)
---- testing: ' 123abc' << 'a5.9' ---
-int(123)
---- testing: '123 abc' << '0' ---
-int(123)
---- testing: '123 abc' << '65' ---
-int(0)
---- testing: '123 abc' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '123 abc' << '1.2' ---
-int(246)
---- testing: '123 abc' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '123 abc' << 'abc' ---
-int(123)
---- testing: '123 abc' << '123abc' ---
-int(0)
---- testing: '123 abc' << '123e5' ---
-int(0)
---- testing: '123 abc' << '123e5xyz' ---
-int(0)
---- testing: '123 abc' << ' 123abc' ---
-int(0)
---- testing: '123 abc' << '123 abc' ---
-int(0)
---- testing: '123 abc' << '123abc ' ---
-int(0)
---- testing: '123 abc' << '3.4a' ---
-int(984)
---- testing: '123 abc' << 'a5.9' ---
-int(123)
---- testing: '123abc ' << '0' ---
-int(123)
---- testing: '123abc ' << '65' ---
-int(0)
---- testing: '123abc ' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '123abc ' << '1.2' ---
-int(246)
---- testing: '123abc ' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '123abc ' << 'abc' ---
-int(123)
---- testing: '123abc ' << '123abc' ---
-int(0)
---- testing: '123abc ' << '123e5' ---
-int(0)
---- testing: '123abc ' << '123e5xyz' ---
-int(0)
---- testing: '123abc ' << ' 123abc' ---
-int(0)
---- testing: '123abc ' << '123 abc' ---
-int(0)
---- testing: '123abc ' << '123abc ' ---
-int(0)
---- testing: '123abc ' << '3.4a' ---
-int(984)
---- testing: '123abc ' << 'a5.9' ---
-int(123)
---- testing: '3.4a' << '0' ---
-int(3)
---- testing: '3.4a' << '65' ---
-int(0)
---- testing: '3.4a' << '-44' ---
-Exception: Bit shift by negative number
---- testing: '3.4a' << '1.2' ---
-int(6)
---- testing: '3.4a' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: '3.4a' << 'abc' ---
-int(3)
---- testing: '3.4a' << '123abc' ---
-int(0)
---- testing: '3.4a' << '123e5' ---
-int(0)
---- testing: '3.4a' << '123e5xyz' ---
-int(0)
---- testing: '3.4a' << ' 123abc' ---
-int(0)
---- testing: '3.4a' << '123 abc' ---
-int(0)
---- testing: '3.4a' << '123abc ' ---
-int(0)
---- testing: '3.4a' << '3.4a' ---
-int(24)
---- testing: '3.4a' << 'a5.9' ---
-int(3)
---- testing: 'a5.9' << '0' ---
-int(0)
---- testing: 'a5.9' << '65' ---
-int(0)
---- testing: 'a5.9' << '-44' ---
-Exception: Bit shift by negative number
---- testing: 'a5.9' << '1.2' ---
-int(0)
---- testing: 'a5.9' << '-7.7' ---
-Exception: Bit shift by negative number
---- testing: 'a5.9' << 'abc' ---
-int(0)
---- testing: 'a5.9' << '123abc' ---
-int(0)
---- testing: 'a5.9' << '123e5' ---
-int(0)
---- testing: 'a5.9' << '123e5xyz' ---
-int(0)
---- testing: 'a5.9' << ' 123abc' ---
-int(0)
---- testing: 'a5.9' << '123 abc' ---
-int(0)
---- testing: 'a5.9' << '123abc ' ---
-int(0)
---- testing: 'a5.9' << '3.4a' ---
-int(0)
---- testing: 'a5.9' << 'a5.9' ---
-int(0)
-===DONE===
+--TEST-- +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=== diff --git a/tests/lang/operators/bitwiseXor_variationStr.phpt b/tests/lang/operators/bitwiseXor_variationStr.phpt index 7dda65910a..64d5eb75d8 100644 --- a/tests/lang/operators/bitwiseXor_variationStr.phpt +++ b/tests/lang/operators/bitwiseXor_variationStr.phpt @@ -1,26 +1,26 @@ ---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--
+--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"
-===DONE===
+string(8) "00000000" +===DONE=== diff --git a/tests/lang/operators/divide_basiclong_64bit.phpt b/tests/lang/operators/divide_basiclong_64bit.phpt index c6bed0c88b..0dd08f534f 100644 --- a/tests/lang/operators/divide_basiclong_64bit.phpt +++ b/tests/lang/operators/divide_basiclong_64bit.phpt @@ -1,44 +1,44 @@ ---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--
+--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)
-===DONE===
+float(-1) +===DONE=== diff --git a/tests/lang/operators/divide_variationStr.phpt b/tests/lang/operators/divide_variationStr.phpt index f54013fcec..88ff8f1840 100644 --- a/tests/lang/operators/divide_variationStr.phpt +++ b/tests/lang/operators/divide_variationStr.phpt @@ -1,26 +1,26 @@ ---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--
+--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)
-===DONE===
+float(NAN) +===DONE=== diff --git a/tests/lang/operators/modulus_variationStr.phpt b/tests/lang/operators/modulus_variationStr.phpt index 4cfd7768ff..6441428e3e 100644 --- a/tests/lang/operators/modulus_variationStr.phpt +++ b/tests/lang/operators/modulus_variationStr.phpt @@ -1,420 +1,420 @@ ---TEST--
-Test % operator : various numbers as strings
---FILE--
-<?php
-
-$strVals = array(
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
- "a5.9"
-);
-
-error_reporting(E_ERROR);
-
-foreach ($strVals as $strVal) {
- foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' % '$otherVal' ---\n";
- try {
- var_dump($strVal%$otherVal);
- } catch (DivisionByZeroError $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
- }
-}
-
-
-?>
-===DONE===
---EXPECT--
---- testing: '0' % '0' ---
-Exception: Modulo by zero
---- testing: '0' % '65' ---
-int(0)
---- testing: '0' % '-44' ---
-int(0)
---- testing: '0' % '1.2' ---
-int(0)
---- testing: '0' % '-7.7' ---
-int(0)
---- testing: '0' % 'abc' ---
-Exception: Modulo by zero
---- testing: '0' % '123abc' ---
-int(0)
---- testing: '0' % '123e5' ---
-int(0)
---- testing: '0' % '123e5xyz' ---
-int(0)
---- testing: '0' % ' 123abc' ---
-int(0)
---- testing: '0' % '123 abc' ---
-int(0)
---- testing: '0' % '123abc ' ---
-int(0)
---- testing: '0' % '3.4a' ---
-int(0)
---- testing: '0' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '65' % '0' ---
-Exception: Modulo by zero
---- testing: '65' % '65' ---
-int(0)
---- testing: '65' % '-44' ---
-int(21)
---- testing: '65' % '1.2' ---
-int(0)
---- testing: '65' % '-7.7' ---
-int(2)
---- testing: '65' % 'abc' ---
-Exception: Modulo by zero
---- testing: '65' % '123abc' ---
-int(65)
---- testing: '65' % '123e5' ---
-int(65)
---- testing: '65' % '123e5xyz' ---
-int(65)
---- testing: '65' % ' 123abc' ---
-int(65)
---- testing: '65' % '123 abc' ---
-int(65)
---- testing: '65' % '123abc ' ---
-int(65)
---- testing: '65' % '3.4a' ---
-int(2)
---- testing: '65' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '-44' % '0' ---
-Exception: Modulo by zero
---- testing: '-44' % '65' ---
-int(-44)
---- testing: '-44' % '-44' ---
-int(0)
---- testing: '-44' % '1.2' ---
-int(0)
---- testing: '-44' % '-7.7' ---
-int(-2)
---- testing: '-44' % 'abc' ---
-Exception: Modulo by zero
---- testing: '-44' % '123abc' ---
-int(-44)
---- testing: '-44' % '123e5' ---
-int(-44)
---- testing: '-44' % '123e5xyz' ---
-int(-44)
---- testing: '-44' % ' 123abc' ---
-int(-44)
---- testing: '-44' % '123 abc' ---
-int(-44)
---- testing: '-44' % '123abc ' ---
-int(-44)
---- testing: '-44' % '3.4a' ---
-int(-2)
---- testing: '-44' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '1.2' % '0' ---
-Exception: Modulo by zero
---- testing: '1.2' % '65' ---
-int(1)
---- testing: '1.2' % '-44' ---
-int(1)
---- testing: '1.2' % '1.2' ---
-int(0)
---- testing: '1.2' % '-7.7' ---
-int(1)
---- testing: '1.2' % 'abc' ---
-Exception: Modulo by zero
---- testing: '1.2' % '123abc' ---
-int(1)
---- testing: '1.2' % '123e5' ---
-int(1)
---- testing: '1.2' % '123e5xyz' ---
-int(1)
---- testing: '1.2' % ' 123abc' ---
-int(1)
---- testing: '1.2' % '123 abc' ---
-int(1)
---- testing: '1.2' % '123abc ' ---
-int(1)
---- testing: '1.2' % '3.4a' ---
-int(1)
---- testing: '1.2' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '-7.7' % '0' ---
-Exception: Modulo by zero
---- testing: '-7.7' % '65' ---
-int(-7)
---- testing: '-7.7' % '-44' ---
-int(-7)
---- testing: '-7.7' % '1.2' ---
-int(0)
---- testing: '-7.7' % '-7.7' ---
-int(0)
---- testing: '-7.7' % 'abc' ---
-Exception: Modulo by zero
---- testing: '-7.7' % '123abc' ---
-int(-7)
---- testing: '-7.7' % '123e5' ---
-int(-7)
---- testing: '-7.7' % '123e5xyz' ---
-int(-7)
---- testing: '-7.7' % ' 123abc' ---
-int(-7)
---- testing: '-7.7' % '123 abc' ---
-int(-7)
---- testing: '-7.7' % '123abc ' ---
-int(-7)
---- testing: '-7.7' % '3.4a' ---
-int(-1)
---- testing: '-7.7' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: 'abc' % '0' ---
-Exception: Modulo by zero
---- testing: 'abc' % '65' ---
-int(0)
---- testing: 'abc' % '-44' ---
-int(0)
---- testing: 'abc' % '1.2' ---
-int(0)
---- testing: 'abc' % '-7.7' ---
-int(0)
---- testing: 'abc' % 'abc' ---
-Exception: Modulo by zero
---- testing: 'abc' % '123abc' ---
-int(0)
---- testing: 'abc' % '123e5' ---
-int(0)
---- testing: 'abc' % '123e5xyz' ---
-int(0)
---- testing: 'abc' % ' 123abc' ---
-int(0)
---- testing: 'abc' % '123 abc' ---
-int(0)
---- testing: 'abc' % '123abc ' ---
-int(0)
---- testing: 'abc' % '3.4a' ---
-int(0)
---- testing: 'abc' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '123abc' % '0' ---
-Exception: Modulo by zero
---- testing: '123abc' % '65' ---
-int(58)
---- testing: '123abc' % '-44' ---
-int(35)
---- testing: '123abc' % '1.2' ---
-int(0)
---- testing: '123abc' % '-7.7' ---
-int(4)
---- testing: '123abc' % 'abc' ---
-Exception: Modulo by zero
---- testing: '123abc' % '123abc' ---
-int(0)
---- testing: '123abc' % '123e5' ---
-int(123)
---- testing: '123abc' % '123e5xyz' ---
-int(123)
---- testing: '123abc' % ' 123abc' ---
-int(0)
---- testing: '123abc' % '123 abc' ---
-int(0)
---- testing: '123abc' % '123abc ' ---
-int(0)
---- testing: '123abc' % '3.4a' ---
-int(0)
---- testing: '123abc' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '123e5' % '0' ---
-Exception: Modulo by zero
---- testing: '123e5' % '65' ---
-int(50)
---- testing: '123e5' % '-44' ---
-int(20)
---- testing: '123e5' % '1.2' ---
-int(0)
---- testing: '123e5' % '-7.7' ---
-int(6)
---- testing: '123e5' % 'abc' ---
-Exception: Modulo by zero
---- testing: '123e5' % '123abc' ---
-int(0)
---- testing: '123e5' % '123e5' ---
-int(0)
---- testing: '123e5' % '123e5xyz' ---
-int(0)
---- testing: '123e5' % ' 123abc' ---
-int(0)
---- testing: '123e5' % '123 abc' ---
-int(0)
---- testing: '123e5' % '123abc ' ---
-int(0)
---- testing: '123e5' % '3.4a' ---
-int(0)
---- testing: '123e5' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '123e5xyz' % '0' ---
-Exception: Modulo by zero
---- testing: '123e5xyz' % '65' ---
-int(50)
---- testing: '123e5xyz' % '-44' ---
-int(20)
---- testing: '123e5xyz' % '1.2' ---
-int(0)
---- testing: '123e5xyz' % '-7.7' ---
-int(6)
---- testing: '123e5xyz' % 'abc' ---
-Exception: Modulo by zero
---- testing: '123e5xyz' % '123abc' ---
-int(0)
---- testing: '123e5xyz' % '123e5' ---
-int(0)
---- testing: '123e5xyz' % '123e5xyz' ---
-int(0)
---- testing: '123e5xyz' % ' 123abc' ---
-int(0)
---- testing: '123e5xyz' % '123 abc' ---
-int(0)
---- testing: '123e5xyz' % '123abc ' ---
-int(0)
---- testing: '123e5xyz' % '3.4a' ---
-int(0)
---- testing: '123e5xyz' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: ' 123abc' % '0' ---
-Exception: Modulo by zero
---- testing: ' 123abc' % '65' ---
-int(58)
---- testing: ' 123abc' % '-44' ---
-int(35)
---- testing: ' 123abc' % '1.2' ---
-int(0)
---- testing: ' 123abc' % '-7.7' ---
-int(4)
---- testing: ' 123abc' % 'abc' ---
-Exception: Modulo by zero
---- testing: ' 123abc' % '123abc' ---
-int(0)
---- testing: ' 123abc' % '123e5' ---
-int(123)
---- testing: ' 123abc' % '123e5xyz' ---
-int(123)
---- testing: ' 123abc' % ' 123abc' ---
-int(0)
---- testing: ' 123abc' % '123 abc' ---
-int(0)
---- testing: ' 123abc' % '123abc ' ---
-int(0)
---- testing: ' 123abc' % '3.4a' ---
-int(0)
---- testing: ' 123abc' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '123 abc' % '0' ---
-Exception: Modulo by zero
---- testing: '123 abc' % '65' ---
-int(58)
---- testing: '123 abc' % '-44' ---
-int(35)
---- testing: '123 abc' % '1.2' ---
-int(0)
---- testing: '123 abc' % '-7.7' ---
-int(4)
---- testing: '123 abc' % 'abc' ---
-Exception: Modulo by zero
---- testing: '123 abc' % '123abc' ---
-int(0)
---- testing: '123 abc' % '123e5' ---
-int(123)
---- testing: '123 abc' % '123e5xyz' ---
-int(123)
---- testing: '123 abc' % ' 123abc' ---
-int(0)
---- testing: '123 abc' % '123 abc' ---
-int(0)
---- testing: '123 abc' % '123abc ' ---
-int(0)
---- testing: '123 abc' % '3.4a' ---
-int(0)
---- testing: '123 abc' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '123abc ' % '0' ---
-Exception: Modulo by zero
---- testing: '123abc ' % '65' ---
-int(58)
---- testing: '123abc ' % '-44' ---
-int(35)
---- testing: '123abc ' % '1.2' ---
-int(0)
---- testing: '123abc ' % '-7.7' ---
-int(4)
---- testing: '123abc ' % 'abc' ---
-Exception: Modulo by zero
---- testing: '123abc ' % '123abc' ---
-int(0)
---- testing: '123abc ' % '123e5' ---
-int(123)
---- testing: '123abc ' % '123e5xyz' ---
-int(123)
---- testing: '123abc ' % ' 123abc' ---
-int(0)
---- testing: '123abc ' % '123 abc' ---
-int(0)
---- testing: '123abc ' % '123abc ' ---
-int(0)
---- testing: '123abc ' % '3.4a' ---
-int(0)
---- testing: '123abc ' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: '3.4a' % '0' ---
-Exception: Modulo by zero
---- testing: '3.4a' % '65' ---
-int(3)
---- testing: '3.4a' % '-44' ---
-int(3)
---- testing: '3.4a' % '1.2' ---
-int(0)
---- testing: '3.4a' % '-7.7' ---
-int(3)
---- testing: '3.4a' % 'abc' ---
-Exception: Modulo by zero
---- testing: '3.4a' % '123abc' ---
-int(3)
---- testing: '3.4a' % '123e5' ---
-int(3)
---- testing: '3.4a' % '123e5xyz' ---
-int(3)
---- testing: '3.4a' % ' 123abc' ---
-int(3)
---- testing: '3.4a' % '123 abc' ---
-int(3)
---- testing: '3.4a' % '123abc ' ---
-int(3)
---- testing: '3.4a' % '3.4a' ---
-int(0)
---- testing: '3.4a' % 'a5.9' ---
-Exception: Modulo by zero
---- testing: 'a5.9' % '0' ---
-Exception: Modulo by zero
---- testing: 'a5.9' % '65' ---
-int(0)
---- testing: 'a5.9' % '-44' ---
-int(0)
---- testing: 'a5.9' % '1.2' ---
-int(0)
---- testing: 'a5.9' % '-7.7' ---
-int(0)
---- testing: 'a5.9' % 'abc' ---
-Exception: Modulo by zero
---- testing: 'a5.9' % '123abc' ---
-int(0)
---- testing: 'a5.9' % '123e5' ---
-int(0)
---- testing: 'a5.9' % '123e5xyz' ---
-int(0)
---- testing: 'a5.9' % ' 123abc' ---
-int(0)
---- testing: 'a5.9' % '123 abc' ---
-int(0)
---- testing: 'a5.9' % '123abc ' ---
-int(0)
---- testing: 'a5.9' % '3.4a' ---
-int(0)
---- testing: 'a5.9' % 'a5.9' ---
-Exception: Modulo by zero
-===DONE===
+--TEST-- +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=== diff --git a/tests/lang/operators/multiply_basiclong_64bit.phpt b/tests/lang/operators/multiply_basiclong_64bit.phpt index 4c7077bf3b..31d9188a77 100644 --- a/tests/lang/operators/multiply_basiclong_64bit.phpt +++ b/tests/lang/operators/multiply_basiclong_64bit.phpt @@ -1,44 +1,44 @@ ---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--
+--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)
-===DONE===
+float(-8.5070591730235E+37) +===DONE=== diff --git a/tests/lang/operators/multiply_variationStr.phpt b/tests/lang/operators/multiply_variationStr.phpt index 30d5f79f1a..01d7e05074 100644 --- a/tests/lang/operators/multiply_variationStr.phpt +++ b/tests/lang/operators/multiply_variationStr.phpt @@ -1,26 +1,26 @@ ---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--
+--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)
-===DONE===
+int(0) +===DONE=== diff --git a/tests/lang/operators/negate_basiclong_64bit.phpt b/tests/lang/operators/negate_basiclong_64bit.phpt index e0cf10da69..47b25e5397 100644 --- a/tests/lang/operators/negate_basiclong_64bit.phpt +++ b/tests/lang/operators/negate_basiclong_64bit.phpt @@ -1,32 +1,32 @@ ---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--
+--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)
-===DONE===
+float(9.2233720368548E+18) +===DONE=== diff --git a/tests/lang/operators/negate_variationStr.phpt b/tests/lang/operators/negate_variationStr.phpt index 7405d42882..ccff2fba2c 100644 --- a/tests/lang/operators/negate_variationStr.phpt +++ b/tests/lang/operators/negate_variationStr.phpt @@ -1,22 +1,22 @@ ---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--
+--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)
-===DONE===
+int(0) +===DONE=== diff --git a/tests/lang/operators/operator_equals_basic.phpt b/tests/lang/operators/operator_equals_basic.phpt index 3cb2704444..9de4ed1a2a 100644 --- a/tests/lang/operators/operator_equals_basic.phpt +++ b/tests/lang/operators/operator_equals_basic.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_equals_variation.phpt b/tests/lang/operators/operator_equals_variation.phpt index f7dc32868c..d72253404b 100644 --- a/tests/lang/operators/operator_equals_variation.phpt +++ b/tests/lang/operators/operator_equals_variation.phpt @@ -1,63 +1,63 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_equals_variation_64bit.phpt b/tests/lang/operators/operator_equals_variation_64bit.phpt index 6329225fcc..ada6c2d7ec 100644 --- a/tests/lang/operators/operator_equals_variation_64bit.phpt +++ b/tests/lang/operators/operator_equals_variation_64bit.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_gt_basic.phpt b/tests/lang/operators/operator_gt_basic.phpt index c410b19dc8..db856c62e6 100644 --- a/tests/lang/operators/operator_gt_basic.phpt +++ b/tests/lang/operators/operator_gt_basic.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_gt_or_equal_basic.phpt b/tests/lang/operators/operator_gt_or_equal_basic.phpt index 20b00df8bb..f1b1e01048 100644 --- a/tests/lang/operators/operator_gt_or_equal_basic.phpt +++ b/tests/lang/operators/operator_gt_or_equal_basic.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_gt_or_equal_variation.phpt b/tests/lang/operators/operator_gt_or_equal_variation.phpt index 6cb6ed6d81..2355ab4c45 100644 --- a/tests/lang/operators/operator_gt_or_equal_variation.phpt +++ b/tests/lang/operators/operator_gt_or_equal_variation.phpt @@ -1,63 +1,63 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt b/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt index 52ef7100a6..8a1ed35f10 100644 --- a/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt +++ b/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt @@ -1,63 +1,63 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_gt_variation.phpt b/tests/lang/operators/operator_gt_variation.phpt index 1b429a076f..ff15550dbe 100644 --- a/tests/lang/operators/operator_gt_variation.phpt +++ b/tests/lang/operators/operator_gt_variation.phpt @@ -1,62 +1,62 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_gt_variation_64bit.phpt b/tests/lang/operators/operator_gt_variation_64bit.phpt index 1881567080..15c6b88319 100644 --- a/tests/lang/operators/operator_gt_variation_64bit.phpt +++ b/tests/lang/operators/operator_gt_variation_64bit.phpt @@ -1,62 +1,62 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_identical_basic.phpt b/tests/lang/operators/operator_identical_basic.phpt index dbf4c62f5b..e3a0fe272f 100644 --- a/tests/lang/operators/operator_identical_basic.phpt +++ b/tests/lang/operators/operator_identical_basic.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_identical_variation.phpt b/tests/lang/operators/operator_identical_variation.phpt index f2150e956d..a215fef0a4 100644 --- a/tests/lang/operators/operator_identical_variation.phpt +++ b/tests/lang/operators/operator_identical_variation.phpt @@ -1,63 +1,63 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_identical_variation_64bit.phpt b/tests/lang/operators/operator_identical_variation_64bit.phpt index 138a53a119..0c8d398daf 100644 --- a/tests/lang/operators/operator_identical_variation_64bit.phpt +++ b/tests/lang/operators/operator_identical_variation_64bit.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_lt_basic.phpt b/tests/lang/operators/operator_lt_basic.phpt index 016b35dd4b..41f18ef9d2 100644 --- a/tests/lang/operators/operator_lt_basic.phpt +++ b/tests/lang/operators/operator_lt_basic.phpt @@ -1,62 +1,62 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_lt_or_equal_basic.phpt b/tests/lang/operators/operator_lt_or_equal_basic.phpt index 785b9338ac..85a86e1996 100644 --- a/tests/lang/operators/operator_lt_or_equal_basic.phpt +++ b/tests/lang/operators/operator_lt_or_equal_basic.phpt @@ -1,64 +1,64 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_lt_or_equal_variation.phpt b/tests/lang/operators/operator_lt_or_equal_variation.phpt index 293205876d..5724511a0e 100644 --- a/tests/lang/operators/operator_lt_or_equal_variation.phpt +++ b/tests/lang/operators/operator_lt_or_equal_variation.phpt @@ -1,63 +1,63 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt b/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt index 055cfc673b..f3b16c1fc9 100644 --- a/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt +++ b/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt @@ -1,63 +1,63 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_lt_variation.phpt b/tests/lang/operators/operator_lt_variation.phpt index 62fedfad5a..4f468638dc 100644 --- a/tests/lang/operators/operator_lt_variation.phpt +++ b/tests/lang/operators/operator_lt_variation.phpt @@ -1,60 +1,60 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_lt_variation_64bit.phpt b/tests/lang/operators/operator_lt_variation_64bit.phpt index e6f16a3883..3ee274aea0 100644 --- a/tests/lang/operators/operator_lt_variation_64bit.phpt +++ b/tests/lang/operators/operator_lt_variation_64bit.phpt @@ -1,60 +1,60 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_notequals_basic.phpt b/tests/lang/operators/operator_notequals_basic.phpt index 80754dacb4..cef0be6279 100644 --- a/tests/lang/operators/operator_notequals_basic.phpt +++ b/tests/lang/operators/operator_notequals_basic.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_notequals_variation.phpt b/tests/lang/operators/operator_notequals_variation.phpt index 2a0b57035d..25bbfc5859 100644 --- a/tests/lang/operators/operator_notequals_variation.phpt +++ b/tests/lang/operators/operator_notequals_variation.phpt @@ -1,63 +1,63 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_notequals_variation_64bit.phpt b/tests/lang/operators/operator_notequals_variation_64bit.phpt index 16ec925cb8..6fbc496fa5 100644 --- a/tests/lang/operators/operator_notequals_variation_64bit.phpt +++ b/tests/lang/operators/operator_notequals_variation_64bit.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_notidentical_basic.phpt b/tests/lang/operators/operator_notidentical_basic.phpt index 143d72038b..9f21ea4bca 100644 --- a/tests/lang/operators/operator_notidentical_basic.phpt +++ b/tests/lang/operators/operator_notidentical_basic.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_notidentical_variation.phpt b/tests/lang/operators/operator_notidentical_variation.phpt index 702797ec8d..a9fbcf60e1 100644 --- a/tests/lang/operators/operator_notidentical_variation.phpt +++ b/tests/lang/operators/operator_notidentical_variation.phpt @@ -1,64 +1,64 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_notidentical_variation_64bit.phpt b/tests/lang/operators/operator_notidentical_variation_64bit.phpt index 8a60cfdbb4..aa5aab7a59 100644 --- a/tests/lang/operators/operator_notidentical_variation_64bit.phpt +++ b/tests/lang/operators/operator_notidentical_variation_64bit.phpt @@ -1,65 +1,65 @@ ---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
+--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=== diff --git a/tests/lang/operators/operator_spaceship_basic.phpt b/tests/lang/operators/operator_spaceship_basic.phpt index 3dbdbb4197..81b0516757 100644 --- a/tests/lang/operators/operator_spaceship_basic.phpt +++ b/tests/lang/operators/operator_spaceship_basic.phpt @@ -1,94 +1,94 @@ ---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
+--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=== diff --git a/tests/lang/operators/postdec_basiclong_64bit.phpt b/tests/lang/operators/postdec_basiclong_64bit.phpt index 9875df85ae..f3e825ca3d 100644 --- a/tests/lang/operators/postdec_basiclong_64bit.phpt +++ b/tests/lang/operators/postdec_basiclong_64bit.phpt @@ -1,61 +1,61 @@ ---TEST--
-Test N-- operator : 64bit long tests
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-
-define("MAX_64Bit", 9223372036854775807);
-define("MAX_32Bit", 2147483647);
-define("MIN_64Bit", -9223372036854775807 - 1);
-define("MIN_32Bit", -2147483647 - 1);
-
-$longVals = array(
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
-);
-
-
-foreach ($longVals as $longVal) {
- echo "--- testing: $longVal ---\n";
- $longVal--;
- var_dump($longVal);
-}
-
-?>
-===DONE===
---EXPECT--
---- testing: 9223372036854775807 ---
-int(9223372036854775806)
---- testing: -9223372036854775808 ---
-float(-9.2233720368548E+18)
---- testing: 2147483647 ---
-int(2147483646)
---- testing: -2147483648 ---
-int(-2147483649)
---- testing: 9223372034707292160 ---
-int(9223372034707292159)
---- testing: -9223372034707292160 ---
-int(-9223372034707292161)
---- testing: 2147483648 ---
-int(2147483647)
---- testing: -2147483649 ---
-int(-2147483650)
---- testing: 4294967294 ---
-int(4294967293)
---- testing: 4294967295 ---
-int(4294967294)
---- testing: 4294967293 ---
-int(4294967292)
---- testing: 9223372036854775806 ---
-int(9223372036854775805)
---- testing: 9.2233720368548E+18 ---
-float(9.2233720368548E+18)
---- testing: -9223372036854775807 ---
-int(-9223372036854775808)
---- testing: -9.2233720368548E+18 ---
-float(-9.2233720368548E+18)
-===DONE===
+--TEST-- +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=== diff --git a/tests/lang/operators/postdec_variationStr.phpt b/tests/lang/operators/postdec_variationStr.phpt index ee5a8cd4b7..0db326d27e 100644 --- a/tests/lang/operators/postdec_variationStr.phpt +++ b/tests/lang/operators/postdec_variationStr.phpt @@ -1,49 +1,49 @@ ---TEST--
-Test N-- operator : various numbers as strings
---FILE--
-<?php
-
-$strVals = array(
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
- "a5.9"
-);
-
-
-foreach ($strVals as $strVal) {
- echo "--- testing: '$strVal' ---\n";
- $strVal--;
- var_dump($strVal);
-}
-
-?>
-===DONE===
---EXPECT--
---- testing: '0' ---
-int(-1)
---- testing: '65' ---
-int(64)
---- testing: '-44' ---
-int(-45)
---- testing: '1.2' ---
-float(0.2)
---- testing: '-7.7' ---
-float(-8.7)
---- testing: 'abc' ---
-string(3) "abc"
---- testing: '123abc' ---
-string(6) "123abc"
---- testing: '123e5' ---
-float(12299999)
---- testing: '123e5xyz' ---
-string(8) "123e5xyz"
---- testing: ' 123abc' ---
-string(7) " 123abc"
---- testing: '123 abc' ---
-string(7) "123 abc"
---- testing: '123abc ' ---
-string(7) "123abc "
---- testing: '3.4a' ---
-string(4) "3.4a"
---- testing: 'a5.9' ---
-string(4) "a5.9"
-===DONE===
+--TEST-- +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=== diff --git a/tests/lang/operators/postinc_basiclong_64bit.phpt b/tests/lang/operators/postinc_basiclong_64bit.phpt index 494259acd8..18e8bddedd 100644 --- a/tests/lang/operators/postinc_basiclong_64bit.phpt +++ b/tests/lang/operators/postinc_basiclong_64bit.phpt @@ -1,61 +1,61 @@ ---TEST--
-Test N++ operator : 64bit long tests
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-
-define("MAX_64Bit", 9223372036854775807);
-define("MAX_32Bit", 2147483647);
-define("MIN_64Bit", -9223372036854775807 - 1);
-define("MIN_32Bit", -2147483647 - 1);
-
-$longVals = array(
- MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
- MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
- MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
-);
-
-
-foreach ($longVals as $longVal) {
- echo "--- testing: $longVal ---\n";
- $longVal++;
- var_dump($longVal);
-}
-
-?>
-===DONE===
---EXPECT--
---- testing: 9223372036854775807 ---
-float(9.2233720368548E+18)
---- testing: -9223372036854775808 ---
-int(-9223372036854775807)
---- testing: 2147483647 ---
-int(2147483648)
---- testing: -2147483648 ---
-int(-2147483647)
---- testing: 9223372034707292160 ---
-int(9223372034707292161)
---- testing: -9223372034707292160 ---
-int(-9223372034707292159)
---- testing: 2147483648 ---
-int(2147483649)
---- testing: -2147483649 ---
-int(-2147483648)
---- testing: 4294967294 ---
-int(4294967295)
---- testing: 4294967295 ---
-int(4294967296)
---- testing: 4294967293 ---
-int(4294967294)
---- testing: 9223372036854775806 ---
-int(9223372036854775807)
---- testing: 9.2233720368548E+18 ---
-float(9.2233720368548E+18)
---- testing: -9223372036854775807 ---
-int(-9223372036854775806)
---- testing: -9.2233720368548E+18 ---
-float(-9.2233720368548E+18)
-===DONE===
+--TEST-- +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=== diff --git a/tests/lang/operators/postinc_variationStr.phpt b/tests/lang/operators/postinc_variationStr.phpt index 6fbe804319..35e19888e1 100644 --- a/tests/lang/operators/postinc_variationStr.phpt +++ b/tests/lang/operators/postinc_variationStr.phpt @@ -1,49 +1,49 @@ ---TEST--
-Test N++ operator : various numbers as strings
---FILE--
-<?php
-
-$strVals = array(
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
- "a5.9"
-);
-
-
-foreach ($strVals as $strVal) {
- echo "--- testing: '$strVal' ---\n";
- $strVal++;
- var_dump($strVal);
-}
-
-?>
-===DONE===
---EXPECT--
---- testing: '0' ---
-int(1)
---- testing: '65' ---
-int(66)
---- testing: '-44' ---
-int(-43)
---- testing: '1.2' ---
-float(2.2)
---- testing: '-7.7' ---
-float(-6.7)
---- testing: 'abc' ---
-string(3) "abd"
---- testing: '123abc' ---
-string(6) "123abd"
---- testing: '123e5' ---
-float(12300001)
---- testing: '123e5xyz' ---
-string(8) "123e5xza"
---- testing: ' 123abc' ---
-string(7) " 123abd"
---- testing: '123 abc' ---
-string(7) "123 abd"
---- testing: '123abc ' ---
-string(7) "123abc "
---- testing: '3.4a' ---
-string(4) "3.4b"
---- testing: 'a5.9' ---
-string(4) "a5.0"
-===DONE===
+--TEST-- +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=== diff --git a/tests/lang/operators/predec_basiclong_64bit.phpt b/tests/lang/operators/predec_basiclong_64bit.phpt index c1b15fdf34..b2b11709b3 100644 --- a/tests/lang/operators/predec_basiclong_64bit.phpt +++ b/tests/lang/operators/predec_basiclong_64bit.phpt @@ -1,32 +1,32 @@ ---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--
+--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)
-===DONE===
+float(-9.2233720368548E+18) +===DONE=== diff --git a/tests/lang/operators/predec_variationStr.phpt b/tests/lang/operators/predec_variationStr.phpt index c7fb5744a0..1d1fade74d 100644 --- a/tests/lang/operators/predec_variationStr.phpt +++ b/tests/lang/operators/predec_variationStr.phpt @@ -1,22 +1,22 @@ ---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--
+--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"
-===DONE===
+string(4) "a5.9" +===DONE=== diff --git a/tests/lang/operators/preinc_basiclong_64bit.phpt b/tests/lang/operators/preinc_basiclong_64bit.phpt index 599aa4e001..e24cc283aa 100644 --- a/tests/lang/operators/preinc_basiclong_64bit.phpt +++ b/tests/lang/operators/preinc_basiclong_64bit.phpt @@ -1,32 +1,32 @@ ---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--
+--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)
-===DONE===
+float(-9.2233720368548E+18) +===DONE=== diff --git a/tests/lang/operators/subtract_basiclong_64bit.phpt b/tests/lang/operators/subtract_basiclong_64bit.phpt index f52b951442..ca80e3f52d 100644 --- a/tests/lang/operators/subtract_basiclong_64bit.phpt +++ b/tests/lang/operators/subtract_basiclong_64bit.phpt @@ -1,44 +1,44 @@ ---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--
+--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)
-===DONE===
+float(1.844674407371E+19) +===DONE=== diff --git a/tests/lang/operators/subtract_variationStr.phpt b/tests/lang/operators/subtract_variationStr.phpt index 5b5bae2e35..51b5ed4dca 100644 --- a/tests/lang/operators/subtract_variationStr.phpt +++ b/tests/lang/operators/subtract_variationStr.phpt @@ -1,26 +1,26 @@ ---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--
+--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)
-===DONE===
+int(0) +===DONE=== diff --git a/tests/lang/returnByReference.001.phpt b/tests/lang/returnByReference.001.phpt index 51e63b8694..1feccd4a97 100644 --- a/tests/lang/returnByReference.001.phpt +++ b/tests/lang/returnByReference.001.phpt @@ -1,20 +1,20 @@ ---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)
+--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) diff --git a/tests/lang/returnByReference.002.phpt b/tests/lang/returnByReference.002.phpt index 1c635b5298..99365f1b14 100644 --- a/tests/lang/returnByReference.002.phpt +++ b/tests/lang/returnByReference.002.phpt @@ -1,29 +1,29 @@ ---TEST--
-Returning a reference from a function.
---FILE--
-<?php
-function &returnRef() {
- global $a;
- return $a;
-}
-
-function returnVal() {
- global $a;
- return $a;
-}
-
-$a = "original";
-$b =& returnVal();
-$b = "changed";
-var_dump($a); //expecting warning + "original"
-
-$a = "original";
-$b =& returnRef();
-$b = "changed";
-var_dump($a); //expecting "changed"
-?>
---EXPECTF--
-
-Notice: Only variables should be assigned by reference in %s on line 13
-string(8) "original"
-string(7) "changed"
+--TEST-- +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" diff --git a/tests/lang/returnByReference.003.phpt b/tests/lang/returnByReference.003.phpt index 3f03037bf5..b14ae69549 100644 --- a/tests/lang/returnByReference.003.phpt +++ b/tests/lang/returnByReference.003.phpt @@ -1,55 +1,55 @@ ---TEST--
-Returning a reference from a function
---FILE--
-<?php
-function returnConstantByValue() {
- return 100;
-}
-
-function &returnConstantByRef() {
- return 100;
-}
-
-function &returnVariableByRef() {
- return $GLOBALS['a'];
-}
-
-echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
-unset($a, $b);
-$a = 4;
-$b = &returnConstantByValue();
-$a++;
-var_dump($a, $b);
-
-echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
-unset($a, $b);
-$a = 4;
-$b = &returnConstantByRef();
-$a++;
-var_dump($a, $b);
-
-echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
-unset($a, $b);
-$a = 4;
-$b = &returnVariableByRef();
-$a++;
-var_dump($a, $b);
-
-?>
---EXPECTF--
-
----> 1. Trying to assign by reference the return value of a function that returns by value:
-
-Notice: Only variables should be assigned by reference in %s on line 17
-int(5)
-int(100)
-
----> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
-
-Notice: Only variable references should be returned by reference in %s on line 7
-int(5)
-int(100)
-
----> 3. Trying to assign by reference the return value of a function that returns by ref:
-int(5)
-int(5)
+--TEST-- +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) diff --git a/tests/lang/returnByReference.004.phpt b/tests/lang/returnByReference.004.phpt index f7d1165a22..b37506ce0a 100644 --- a/tests/lang/returnByReference.004.phpt +++ b/tests/lang/returnByReference.004.phpt @@ -1,57 +1,57 @@ ---TEST--
-Returning a reference from a static method
---FILE--
-<?php
-Class C {
- static function returnConstantByValue() {
- return 100;
- }
-
- static function &returnConstantByRef() {
- return 100;
- }
-
- static function &returnVariableByRef() {
- return $GLOBALS['a'];
- }
-}
-
-echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
-unset($a, $b);
-$a = 4;
-$b = &C::returnConstantByValue();
-$a++;
-var_dump($a, $b);
-
-echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
-unset($a, $b);
-$a = 4;
-$b = &C::returnConstantByRef();
-$a++;
-var_dump($a, $b);
-
-echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
-unset($a, $b);
-$a = 4;
-$b = &C::returnVariableByRef();
-$a++;
-var_dump($a, $b);
-
-?>
---EXPECTF--
-
----> 1. Trying to assign by reference the return value of a function that returns by value:
-
-Notice: Only variables should be assigned by reference in %s on line 19
-int(5)
-int(100)
-
----> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
-
-Notice: Only variable references should be returned by reference in %s on line 8
-int(5)
-int(100)
-
----> 3. Trying to assign by reference the return value of a function that returns by ref:
-int(5)
-int(5)
+--TEST-- +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) diff --git a/tests/lang/returnByReference.005.phpt b/tests/lang/returnByReference.005.phpt index 840b89fa53..adb11617c4 100644 --- a/tests/lang/returnByReference.005.phpt +++ b/tests/lang/returnByReference.005.phpt @@ -1,58 +1,58 @@ ---TEST--
-Returning a reference from a method
---FILE--
-<?php
-Class C {
- function returnConstantByValue() {
- return 100;
- }
-
- function &returnConstantByRef() {
- return 100;
- }
-
- static function &returnVariableByRef() {
- return $GLOBALS['a'];
- }
-}
-$c = new C;
-
-echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
-unset($a, $b);
-$a = 4;
-$b = &$c->returnConstantByValue();
-$a++;
-var_dump($a, $b);
-
-echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
-unset($a, $b);
-$a = 4;
-$b = &$c->returnConstantByRef();
-$a++;
-var_dump($a, $b);
-
-echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
-unset($a, $b);
-$a = 4;
-$b = &$c->returnVariableByRef();
-$a++;
-var_dump($a, $b);
-
-?>
---EXPECTF--
-
----> 1. Trying to assign by reference the return value of a function that returns by value:
-
-Notice: Only variables should be assigned by reference in %s on line 20
-int(5)
-int(100)
-
----> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
-
-Notice: Only variable references should be returned by reference in %s on line 8
-int(5)
-int(100)
-
----> 3. Trying to assign by reference the return value of a function that returns by ref:
-int(5)
-int(5)
+--TEST-- +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) diff --git a/tests/lang/returnByReference.006.phpt b/tests/lang/returnByReference.006.phpt index 4019f3ab45..d2c7041be8 100644 --- a/tests/lang/returnByReference.006.phpt +++ b/tests/lang/returnByReference.006.phpt @@ -1,60 +1,60 @@ ---TEST--
-Returning a reference from a function via another function
---INI--
-error_reporting = E_ALL & ~E_STRICT
---FILE--
-<?php
-function returnConstantByValue() {
- return 100;
-}
-
-function &returnConstantByRef() {
- return 100;
-}
-
-function &returnVariableByRef() {
- return $GLOBALS['a'];
-}
-
-function &returnFunctionCallByRef($functionToCall) {
- return $functionToCall();
-}
-
-echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
-unset($a, $b);
-$a = 4;
-$b = &returnFunctionCallByRef('returnConstantByValue');
-$a++;
-var_dump($a, $b);
-
-echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";
-unset($a, $b);
-$a = 4;
-$b = &returnFunctionCallByRef('returnConstantByRef');
-$a++;
-var_dump($a, $b);
-
-echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";
-unset($a, $b);
-$a = 4;
-$b = &returnFunctionCallByRef('returnVariableByRef');
-$a++;
-var_dump($a, $b);
-
-?>
---EXPECTF--
----> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:
-
-Notice: Only variable references should be returned by reference in %s on line 15
-int(5)
-int(100)
-
----> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:
-
-Notice: Only variable references should be returned by reference in %s on line 7
-int(5)
-int(100)
-
----> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:
-int(5)
-int(5)
+--TEST-- +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) diff --git a/tests/lang/returnByReference.007.phpt b/tests/lang/returnByReference.007.phpt index badb7365f5..45fa0ddc88 100644 --- a/tests/lang/returnByReference.007.phpt +++ b/tests/lang/returnByReference.007.phpt @@ -1,63 +1,63 @@ ---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)
+--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) diff --git a/tests/lang/returnByReference.008.phpt b/tests/lang/returnByReference.008.phpt index 9c396be1bc..3774a917c5 100644 --- a/tests/lang/returnByReference.008.phpt +++ b/tests/lang/returnByReference.008.phpt @@ -1,64 +1,64 @@ ---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)
+--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) diff --git a/tests/lang/returnByReference.009.phpt b/tests/lang/returnByReference.009.phpt index 63203757de..9e7470edbc 100644 --- a/tests/lang/returnByReference.009.phpt +++ b/tests/lang/returnByReference.009.phpt @@ -1,39 +1,39 @@ ---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)
+--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) diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js index 267b8dc67b..d3526b5a2f 100644 --- a/win32/build/buildconf.js +++ b/win32/build/buildconf.js @@ -1,260 +1,260 @@ -/*
- +----------------------------------------------------------------------+
- | 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 %*");
+/* + +----------------------------------------------------------------------+ + | 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 %*"); diff --git a/win32/syslog.reg b/win32/syslog.reg index 2974bfbd48..54184159d0 100644 --- a/win32/syslog.reg +++ b/win32/syslog.reg @@ -1,5 +1,5 @@ -REGEDIT4
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.3.99-dev]
-"TypesSupported"=dword:00000007
-"EventMessageFile"="g:\\test\\srctrunkinstall\\php7ts.dll"
+REGEDIT4 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.3.99-dev] +"TypesSupported"=dword:00000007 +"EventMessageFile"="g:\\test\\srctrunkinstall\\php7ts.dll" |